C++

hello everybody , i'm now learning c++ and i have this probleme that i'm hopping that you help me with it , you see i want to display a file.txt on the desktop yousing c++ i managed to write my data in the file but what i need is to open the file automatically after the writing is finished , i don't want to open the file on the terminal but i want the file to open on the desktop
Can anyone help me with this pleaaaaaaaaaaaaaaaaaaaaase
Last edited on
This link show how to create a file.txt on desktop , what i need is to open it automatically after the writing is finished on the desktop , you see where i'm going here ??
Last edited on
Yes.
You don't want to use existing terminal programs that show the output stream of your program in a GUI window. By "desktop" you don't mean special directory.

By "desktop" you mean GUI. You want to create a GUI window (with all the bells and whistles) within your application that renders the "output content" as text within it.

Am I right?

Qt http://www.qt.io/ is one framework that helps you to do that "relatively" easily. However, the use of any such framework requires rather good command of the programming language (C++). Are you there yet?


One does not need to use GUI frameworks. One can learn esoteric low-level OS-dependent incantations and implement every last detail oneself. There are reasons why that is not a common hobby.
i guess you are talkinking about creating a interface in c++ with Qt , so what i want is not
feasible ??
i don't want to open the file on the terminal but i want the file to open on the desktop
What exactly does that mean? Do you want another application to open the generated file? If so you need system dependent functions like (windows) ShellExecute(...).
i meen when the writing is finished , i don't want to clik on the file to see what is writing , i need to find a commande with c++ that can open the file automatically after the writing is finished is that possible
thanks for your replay :)
Given that you're on windows, you probably have the program notepad.exe on your system.

http://www.cplusplus.com/forum/general/20884/

Do note that using system is, all things considered, a pretty dangerous and uncontrolled way to do this. That thread suggests other functions to use.

I suggest that you get it working with system, as in that thread, and then when the excitement has worn off, learn why using system is dangerous and expensive, and learn how to do it better.
actually i'm working on a raspberry carte not on windows
does this command work
system( "notepad.exe myfile.txt" );

??
Does "raspberry carte" have "notepad.exe"? I bet not. Does it have some other GUI text editor? Most likely. What editor do you use to write code on raspberry?
it has a leafpad , that the one where the writing is
Well then you could do worse than trying
system( "leafpad myfile.txt" );

If you're lucky, leafpad will be on the path.

Then, when it's working, you can stop using system and use something better.
does this command work
Unlikely, notepad.exe is a windows program.

Again: Describe more precisely what this 'open the file automatically' is supposed to do.
do not know how to open the text file i.e. open it as if I would use my mouse and double click on the text file.
What do you think that the double click on an icon representing a file actually does?
It executes some associated command, usually external program and adds filename as command line argument to the command.

Why the program creating the file should open it for you?
You could have a shell script that first runs your program and then starts leafpad (or whatever).
Topic archived. No new replies allowed.