Hi!
I would like to know if it is possible for me to create a subdirectory and write to it?
For example,
instead of ...
b_file.open("1.txt", ios::nocreate);
Do I do this?
b_file.open("\txt\1.txt", ios::nocreate);
Hi!
I would like to know if it is possible for me to create a subdirectory and write to it?
For example,
instead of ...
b_file.open("1.txt", ios::nocreate);
Do I do this?
b_file.open("\txt\1.txt", ios::nocreate);
Theres dir.h (dos.h also) which have functions like rmdir(), mkdir() in it.
then there is the system() also
>>b_file.open("\txt\1.txt", ios::nocreate);
i dont think "that" is possible, maybe if you try with the whole path then it could be but i wouldn't count on it
-
The backslash character is a special character used for escape sequences (\t, \n).Originally posted by Sunzoner
b_file.open("\txt\1.txt", ios::nocreate);
If you want a backslash in your string you need to put an extra backslash before it:
Code:b_file.open("C:\\txt\\1.txt", ios::nocreate);
You could always try...
Code:#include <windows.h> .. CreateDirectory("txt",NULL); SetCurrentDirectory("txt"); b_file.open("1.txt", ios::nocreate);