write file

i tried to write a file..something like this

ofstream file;
file.open ("C:\\Windows\\sample.txt");
file << "blah";

it didnt created a file but i can read it using fstream

can you explain to me how that happened? does it consume space in my pc ??

thanks.

If you can read from the file the file was probably created. What makes you think the file is not created?
i tried to search it in search box..cant find the file

also i tried "c:\\sample.txt" cant find it in my c:\\
Last edited on
Maybe you did a mistake in the code that reads the file.
Did you actually look in the Windows folder? I'm not sure that the windows file search will search the system folders by default.
If this is windows 7 and you are not running as admin, operating system will silently move the file to some virtual location (not really sure what it is exactly).
Topic archived. No new replies allowed.