File Handling in C++

How to Create File in Other locations using turbo c++ file handling "C:\myfile.txt" etc are not working.
It is unlikely your OS will allow you to create a file in the root directory.

But remember, the \ has special meaning in a string. You must double it to use it.

ofstream outf( "C:\\Users\\Pratik\\myfile.txt" );

Hope this helps.
Topic archived. No new replies allowed.