Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to get for your free account now!
C++ CreateDirectory
Name: djas Date: October 18, 2005 at 10:57:46 Pacific OS: Windows XP Pro SP2 CPU/Ram: P4 2.40 GHZ 256 RAM
Comment:
Hey guys, I'm having a bit of a problem using the 'CreateDirectory' function.
:CODE:
#include <iostream> #include <windows.h> #include <string> using namespace std;
int main() { string str; cout << "Type The Name Of The Folder You Want To Create.\n"; cout << "Folder:"; cin >> str; CreateDirectory(str); cout << "\nFolder Created!\n"; cin.get(); return 0; }
:CODE:
It doesn't seem to like that i'm using a variable for the folder name. Any thaughts guys?
2. The first parameter is a pointer to a charater string. The string type is a class. You need to use the c_str() method to extract the C string from the string object.
:CODE: #include <iostream> #include <windows.h> #include <string> using namespace std;
int main() { string str; LPSECURITY_ATTRIBUTES attr; attr = NULL; cout << "Type The Name Of The Folder You Want To Create.\n"; cout << "Folder:"; cin >> str; CreateDirectory(str.c_str(), attr); cout << "\nFolder Created!\n"; cin.get(); return 0; } :CODE:
Summary: I'm having a hard time programing . IF you could please help me .. i would really appreciate. Thank you World! -arora786 Write a C++ Program that emulates a point of sale terminal at a Grocery Stor...
Summary: does anyone know any free c++ compilers that are good other then dev-c++? If not, then do you know any extra project templates, header files, or libraries? any help will be usefull Thanks!! ...