I remember from programming in QBasic that there were ways to look at files on a disk. How can I check the contents of a disk in C++ (or C)? How can I do other DOS-type commands like cd or dir? Thanks
I remember from programming in QBasic that there were ways to look at files on a disk. How can I check the contents of a disk in C++ (or C)? How can I do other DOS-type commands like cd or dir? Thanks
for C look up fopen(), fclose(), fread(), fwrite(), fprintf(), fgetc() ....most members of the f-prefixed family
If you know the name of the files you want to open, or can prompt the user for the file name check out the ifstream class for input, the ofstream class for output.
There are C equivaliants that i am not famialar with. -KEN- already listed them.
If you want to use os system calls, check out the system() function.
It takes a char * and executes that command. So you could use the system function to do a "dir" command, and pipe the output to a text file, you could then open that text file and parse it for the name of files and directorys.