I want to create a program in which the output currently on screen is stored in the file and when required, can be read and printed on the screen as it is.
I want to use it to create a program in turbo c++.

Recommended Answers

All 9 Replies

change printf() to fprintf()

Thanks but i do not want to capture only 1 printf() statement but the whole text printed on screen.

So change all the printf() 's

ok but isn't there a way to read a chracter from the cursor's position and write it to file.

How much programming do you know?

How much programming do you know?

I am beginning to work with file input output. I am just a beginnner in programming, you can say.

Think you should first go through to file handling chapters.
check the link:-- http://www.cprogramming.com/tutorial/cfileio.html

Actually, I have an assignment from school in which i have to simulate the functioning of a dialog box in dos. So i need to write code to restore the screen when the use of dialog box is over.

Actually, I have an assignment from school in which i have to simulate the functioning of a dialog box in dos.

What does this assignment have to do with capturing screen-display into a file? Your program knows what it displayed on the screen previously, just re-display that when you're finished with your simulated dialog box. Depending on the details of which compiler you're using for school, you may be able to use

system("cls");

as a non-portable way to clear the screen before drawing the dialog box, and after "closing" it and re-displaying what was there previously. Once you have more basic stuff done, you may want to look into a "curses" library for better control over where text is displayed in your terminal window, but that sounds more advanced than you really need. Not to mention trying to go back and scrape the current contents of your window into a file, and then read that file back and re-populate your window from it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.