| | |
Directory and folder
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2006
Posts: 43
Reputation:
Solved Threads: 0
Consider a line of simple C code:
fopen("C:\\project\\test1.dat","r");
it "directs" the program to the directory where it can find the file from which it will read.
My question is under what circumstances, I may write
fopen("test1.dat","r") instead?
Does the program need to be in the same folder / directory as test1.dat?
Thanks
fopen("C:\\project\\test1.dat","r");
it "directs" the program to the directory where it can find the file from which it will read.
My question is under what circumstances, I may write
fopen("test1.dat","r") instead?
Does the program need to be in the same folder / directory as test1.dat?
Thanks
•
•
•
•
Originally Posted by yuzhang
Consider a line of simple C code:
fopen("C:\\project\\test1.dat","r");
it "directs" the program to the directory where it can find the file from which it will read.
My question is under what circumstances, I may write
fopen("test1.dat","r") instead?
Does the program need to be in the same folder / directory as test1.dat?
Thanks
In addition, if the file is NOT one the current working directory the program may have to change the current working directory to where the file is. There are a few operating systems where there is no concept of "current working directory", in which case the program has no choice but to specify the full path.
![]() |
Similar Threads
- How do you make a Program instal something inside a folder. (C++)
- Trojans in a weird directory, non-deletable with my antivirus program... (Viruses, Spyware and other Nasties)
- My win xp pro won't load up. (Windows NT / 2000 / XP)
- Massive Hard Drive Space Loss (Windows NT / 2000 / XP)
- How can i delete unused and unneeded images from a folder using php ? (PHP)
- IIS5 - Virtual Directory - SharedFolder Other Drive (Windows NT / 2000 / XP)
- IIS - Vitrual Directory (Windows NT / 2000 / XP)
- loads htm but not aspx (ASP.NET)
- Cannot install samba (*nix Software)
Other Threads in the C++ Forum
- Previous Thread: Dynamic Boolean Array in VC++.net 2003
- Next Thread: finding max value of 10 integers
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline givemetehcodez graph iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






