How to use system() to call on a specific file

Suppose I have a file on the desktop that is example.txt . How would I call on that file?
closed account (3bfGNwbp)
What do you mean by 'call' a file? You shouldn't be using system calls to open a file.
I would want to do something where the code would create a txt file and write something to it (Already know how to do that using fstream). After that I would want to open the file. I thought you could do it the same way you do system("Notepad.exe")
Hoiw about system ((string("C:\\Users\\")+/*enter the name of your profile on the computer*/+"\\Desktop\\example.txt")).c_str())?
But, filestreams are good too, with them you just need to say the name, not file path.
system calls on command prompt so I think you need to use cd/mount before that.
Try this
1
2
system("mount C:\Documents and Settings\All Users\Desktop");
system("cd example.txt");

or
1
2
system("mount C:\Documents and Settings\User name\Desktop")
system("cd example.txt");
Topic archived. No new replies allowed.