Menu

How to save file to another location?

2002-09-09
2012-09-26
  • Nobody/Anonymous

    Hello, my question is how to save file in line:
    ofstream fout("my file.txt");
    to some other location and not only to the default (where unit is saved too)? My default file is D:\Programi\Programi C++ 5. Is it possible to save this text file to any other location? Greetings, Franjo

     
    • Nobody/Anonymous

      Type in the entire address where you want the file to go.  Keep in mind the excape character though.

      eg:
      ofstream fout("C:\\my file.txt");  //or
      ofstream fout(C:\\temp\\myfile.txt);

      Also try to avoid spaces if you can, they can really mess things up at times.

      Curtis

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.