Windows file paths in fstream...?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sejoro
    New Member
    • Feb 2008
    • 9

    Windows file paths in fstream...?

    Hey,

    In my spare time, I've been programming things that require opening files on a windows machine. I know in Unix the <name of file>.open("<pa th">); command will use the directory given, but it wont seem to in Windows. I keep getting errors when I try to do anything like inFile.open("C: \Myfolder\myfil e.txt"); What am I doing wrong?
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    The backslash character '\' is a special character used to make escape characters, such as \n or \t. To get an actual backslash, you need to...backslash it. So wherever you need '\', put in '\\'.

    Comment

    • Sejoro
      New Member
      • Feb 2008
      • 9

      #3
      Sweet, thanks. This has been bothering me forever.

      Comment

      Working...