Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
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:
0
Response Number 2
Name: djas Date: October 20, 2005 at 05:53:10 Pacific
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: I m getting error.....s as follws /*--------------------------------------------------------------------------*/ // stchart.cpp - PegStripChart example // // Author: Jim DeLisle // // Copyright (c) 19...