Originally Posted by kal123456
i created the .txt file and saved it into "My Documents" on my computer so I'm pretty sure the program knows how to access it..
Huh??? They really need to teach you kids some basic MS-DOS!
Do you understand basic directory structure? MS-DOS v2 borrowed it from UNIX. There's a root directory
which contains files and sub-directories
, each of which can contain more files and more sub-directories, forming a directory tree
. The visual "desktop" metaphor that everybody's so enamoured with nowadays is that of "folders", but those "folders" are actually directories. You can traverse that directory tree with the chdir command, "change directory" or CD for short. Every file is in one specific directory and can be accessed through its directory path
, either the absolute directory path
starting from the root directory (called \ in MS-DOS, or / in UNIX/Linux) or a relative directory path
from the current working directory
Actually, MS-DOS and Windows also introduces the idea of volumes
in which each disk drive and device is a separate volume with its own root directory; eg, the hard drive C:. Though in UNIX/Linux, the entire system has one single root directory and devices and extra disk drives (eg, the floppy or the CD-ROM) are mounted under the /mnt directory. But the main idea here is the current working directory!
Every program starts running with a current working directory
, which is normally where the program's executable resides. When you open a file without giving it a directory path, then that file is assumed to reside in the current working directory
. If that file is not there, then it cannot be found by the program; you have to tell the program where to find that file!
Find the directory that the program's executable is in and copy your file there and see whether it works then. Or better, use the function that returns the program's current working directory and display it so that you will know where to put that file so that your program can find it. That function should be GetCurrentDirectory
; RTFM at http://msdn.microsoft.com/en-us/lib...4(v=vs.85).aspx