Thread: Save files move when folder moves

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    16

    Save files move when folder moves

    I have a simple Simulation program that you can save your status but if a user moves the folder from its origanal location the saves wont follow. Is there a way to set it so the saves always save where the program is even if its moved?

  2. #2
    Disturbed Boy gustavosserra's Avatar
    Join Date
    Apr 2003
    Posts
    244
    I didnīt understand well your question, I think... Anyway, if you open a file to append information in it, or open to write in it, the default is to create the file if it does no exists. And this operation is made in the same directory as the program.
    Nothing more to tell about me...
    Happy day =)

  3. #3
    Registered User
    Join Date
    Nov 2003
    Posts
    16
    Im using Dev-C++ and when ever i open a file to write into or read from it creates it the Dev-C++ folder, I want the file to alwasy be in the folder of teh program even if i move it.

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    You can use the GetModuleFileName() API routine to return the full path to the module you are currently running, simply pass a NULL as the first parameter. Strip the module name off the end and there is the directory you want.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Disturbed Boy gustavosserra's Avatar
    Join Date
    Apr 2003
    Posts
    244
    Quote Originally Posted by mill1k
    Im using Dev-C++ and when ever i open a file to write into or read from it creates it the Dev-C++ folder, I want the file to alwasy be in the folder of teh program even if i move it.
    My Dev does not do this... :\
    version 4.9.8.0
    Nothing more to tell about me...
    Happy day =)

  6. #6
    Registered User
    Join Date
    Nov 2003
    Posts
    16
    Ahhh I was using the older version

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text adventure engine idea. thoughts?
    By suzakugaiden in forum Game Programming
    Replies: 16
    Last Post: 01-15-2006, 05:13 AM
  2. Files not updating in folder
    By BobS0327 in forum Tech Board
    Replies: 4
    Last Post: 06-06-2005, 05:55 PM
  3. C+. List no of files in dir and save to int?
    By stephenturns in forum C++ Programming
    Replies: 1
    Last Post: 03-31-2005, 03:59 AM
  4. Formatting Output
    By Aakash Datt in forum C++ Programming
    Replies: 2
    Last Post: 05-16-2003, 08:20 PM
  5. Dos commands hehe
    By Carp in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-17-2003, 02:51 PM