954,504 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Capture screen output in a file

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++.

aero31aero
Newbie Poster
11 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

change printf() to fprintf()

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

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

aero31aero
Newbie Poster
11 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

So change all the printf() 's

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

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

aero31aero
Newbie Poster
11 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

How much programming do you know?

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 
ok but isn't there a way to read a chracter from the cursor's position and write it to file.

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

cse.avinash
Junior Poster
191 posts since Feb 2011
Reputation Points: 10
Solved Threads: 10
 
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.

aero31aero
Newbie Poster
11 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 
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.

aero31aero
Newbie Poster
11 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 
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.

raptr_dflo
Practically a Master Poster
602 posts since Aug 2010
Reputation Points: 76
Solved Threads: 82
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: