Thread: file i/o locations

  1. #1
    yes, I'm registered!!! algi's Avatar
    Join Date
    Nov 2004
    Location
    Ipswich
    Posts
    161

    Post file i/o locations

    I've learnt a bit of File i/o and have made a simple Bank Manager using txt files. I was wandering if there was anyway to make the text documant be saved somewhere else other than the folder that the .exe file is saved in.

    Thanks in advance
    I started out with nothing and I still have most of it left.

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Yes - just specify the whole path of the file and it will be saved in that folder.

  3. #3
    yes, I'm registered!!! algi's Avatar
    Join Date
    Nov 2004
    Location
    Ipswich
    Posts
    161
    how do you specify the whole path. I call it by doing
    ("example.txt")
    I started out with nothing and I still have most of it left.

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Depending on your OS (Unix doesn't use drive letters), you just start with the drive letter and go all the way to the file extension.

    [code]("C:\folder1\folder2\file.type")[code]

    That's an absolute path. What you are doing is called a relative path. You can also access subdirectories that way:

    Code:
    ("subdir1\file.type")

  5. #5
    yes, I'm registered!!! algi's Avatar
    Join Date
    Nov 2004
    Location
    Ipswich
    Posts
    161
    thank-you
    I started out with nothing and I still have most of it left.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. File I/O Assertion Failure in VS2008
    By clegs in forum C Programming
    Replies: 5
    Last Post: 12-25-2008, 04:47 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. 2 questions surrounding an I/O file
    By Guti14 in forum C Programming
    Replies: 2
    Last Post: 08-30-2004, 11:21 PM
  5. advice on file i/o
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-29-2001, 05:56 AM