How to open a document in my desktop using c++ codings ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to open a document in my desktop using c++ codings ?

i want to open a file using c++ . i have heard that it can be done by using system () start or system () explorer. plz help ASAP

13th Jan 2018, 2:59 PM
Ayman Sayed
Ayman Sayed - avatar
2 Answers
+ 3
The code for this will depend on the interpretation of 'open'. 0) open = run a file in the default program. Command : string pf; getline(cin,pf); system("\""+pf+"\""); // Enter the complete path + file name + extension, in pf. 1) open = open folder having the file. Command : string pf; getline(cin,pf); system("explorer \""+pf+"\""); // Enter the complete path + file name + extension, in pf.
13th Jan 2018, 3:44 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
0
thnx for your help
14th Jan 2018, 3:24 AM
Ayman Sayed
Ayman Sayed - avatar