OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 9:46 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: windows file i/o startup
PostPosted: Sun Feb 23, 2003 9:46 pm 
ok, so i have written 2 programs now that both start up when windows starts up, however, they both need file i/o on startup, they both work PERFECTLY cept for the file i/o bit. Ok so here is how it works. I place in HKEY_LOCAL_MACHINE software\microsoft\windows\currentversion\run (the usual place) my key, and the value to where my program is. The problem is not wiht that, the program does start when windows starts, HOWEVER, when it looks for the files, it cannot find them. But when it closes, and i go to the folder where my program is and run it, it runs fine. After some messing around i found that no matter where i specify my program to find the files, .//filename, C:\\Program Files\\folder\\filename, it would no matter what save and read from c:documents and settings\username. but when it closed and i ran the program from the folder it is in, it works fine and does the file i/o from the folder itself. so far i have tried doing the API file io (the CreateFile() function) and any little thing i can find. i open a file with ifstream in; in.open("name.txt"); and if i check to see if the file is loaded, unless it is in C:\documents and settings\username, it doesnt load. Any reason why (is it so simple its in front of my nose?)


Top
  
 
 Post subject: Re:windows file i/o startup
PostPosted: Mon Feb 24, 2003 4:30 pm 
Unless you specify a full path in your open call, you're unlikely to find the file. The Run key doesn't give you any way of specifying the current working directory for a program, as far as I know.


Top
  
 
 Post subject: Re:windows file i/o startup
PostPosted: Mon Feb 24, 2003 10:35 pm 
i did try that, like i did ifstream in; in.open("C:\\Program Files\\init.ini") and even put my program in C: and did in.open("C:\\init.ini"); and it would still look in C:\documents and settings\username. even in.open(".\\init.ini"). i just get soo frustrated because when i open it without having it open when windows starts, it works 100% fine.


Top
  
 
 Post subject: Re:windows file i/o startup
PostPosted: Mon Feb 24, 2003 10:54 pm 
ok well i dont know what in the world i did, i just got home after a 10hr day at work, booted up the prog, and it works 100%. :-\ well thanx for the help. sorry to waste ur time. lol


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 48 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group