![]() |
Need help with opening a file in msdos
Hi
I am programming in c++ and i want to open a .xml file but i want the user to by himself enter the name of thefile he wants to open can someone please tell me what code i should use or even maybe print it in a reply to me thanks lpd1 |
Re: Need help with opening a file in msdos
You should use the scanf to take the input as filename and use the fopen to open the file and fread to read the file and display it to the user.
|
Re: Need help with opening a file in msdos
I presume you mean console/command window when you say "MSDOS". If not, you have an ancient system whose utility in learning will be minimal.
You can get the name from argv if the user provides it on the command line. Since you're using C++, I would recommend you forego C operations like fopen, fgets, scanf, and fread. Use the C++ wrapped stream I/O for greater flexibility and robustness. |
| All times are GMT +5.5. The time now is 07:03. |