Thursday, July 9, 2009

In c++, how do I write to an external text file in a specific folder?

I am using %26lt;fstream%26gt; and created an ofstream called output:


ofstream output ("example.txt");





what do i do if i want to put it in a specific folder, such as C:\Temp

In c++, how do I write to an external text file in a specific folder?
Just use the full path. You will need to double up your \ characters, because \ is an escape character.





So c:\\temp\\test.txt.

baseball cards

No comments:

Post a Comment