file i/o locations

This is a discussion on file i/o locations within the C++ Programming forums, part of the General Programming Boards category; I've learnt a bit of File i/o and have made a simple Bank Manager using txt files. I was wandering ...

  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
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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-31-2004, 12:21 AM
  5. advice on file i/o
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-29-2001, 05:56 AM

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