fstream help!

This is a discussion on fstream help! within the C++ Programming forums, part of the General Programming Boards category; How can i specify a path for the text file i want to use to save or load data? something ...

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    44

    fstream help!

    How can i specify a path for the text file i want to use to save or load data?

    something like this?
    ofstream outFile("C:\text.txt");
    cause when i do that, outFile == false...

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    You probably don't have a tab character (\t) in your filename. To get an actual backslash in a string literal you need two \\ in a row.

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    44
    oh i didnt notice that while writing xD
    thank you!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fstream. I/O
    By kevinawad in forum C++ Programming
    Replies: 2
    Last Post: 07-07-2008, 10:19 AM
  2. using fstream
    By swgh in forum C++ Programming
    Replies: 1
    Last Post: 02-11-2006, 04:53 AM
  3. ARGH! fstream errors
    By OttoDestruct in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2004, 11:37 PM
  4. Are fstream and ofstream incompatible?
    By johnnyd in forum C++ Programming
    Replies: 5
    Last Post: 03-19-2003, 12:21 PM
  5. Problems with fstreams.
    By mosdef in forum C++ Programming
    Replies: 7
    Last Post: 06-19-2002, 04:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21