Thread: reading and creating a file path

  1. #1
    Registered User
    Join Date
    Sep 2002

    reading and creating a file path

    I wrote this program that reads a file on my drive and then puts an updated version of that file on the desktop. The program will reside in a different place. the path is something like this
    output file "c:\documents and settings\greg\desktop\blahblahblah.htm"
    input file "C:\documents and settings\greg\desktop\info.htm"

    the complier won't read the path and throws a few warnings cause it wants to use '\' as an excape character.

    i'm not sure what to do cause i've only rarely used file IO.

    thanks for any help.

  2. #2
    Registered User matheo917's Avatar
    Join Date
    Sep 2001
    that's correct, compiler normally treats "\" (back slash) as an escape character, what you need to use is double back slash "\\" , which in turn is an escape character that "escapes and treats the next character as a back slash itself....

      "c:\\documents and settings\\greg\\desktop\\blahblahblah.htm"

    also on some compilers you can simply use a "forward slash" "/" instead of double back slash, but remember that's compiler dependant....

    hope this helps

    Good luck


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. reading, editing and creating a new file
    By s_jsstevens in forum C Programming
    Replies: 3
    Last Post: 04-27-2007, 02:40 PM
  3. Reading from file and crashing
    By Night_Blade in forum C++ Programming
    Replies: 1
    Last Post: 09-25-2005, 01:09 AM
  4. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 02:58 PM
  5. Creating And Reading From A File
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 10-17-2001, 08:52 PM