How to print in C/C++

S

Sanchit

I want to print a specific portion of output screen using a printer.
How can i do this using C/C++ commands???????

Thanks in advance
 
S

Sanchit

* Sanchit:


DON'T CROSS-POST TO C AND C++ GROUPS.

Also, please consult the relevant FAQ before posting. See e.g. <url:http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.20>,
which treats a very similar question.

Also see <url:http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9>.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


I dont want to clear screen... please read question clearly........
 
L

Lionel B

I want to print a specific portion of output screen using a printer. How
can i do this using C/C++ commands???????

(please do not cross-post to this newsgroup - and note that there is no
such language as C/C++)

C++ does not have any notion of "printer" (nor of "screen", for that
matter), so there is no simple answer to this question. Printing is
*very* platform-specific. How you achieve what you want will certainly
depend on your machine, operating system, printing system, and printer.

You will be better off asking on forums dedicated to your platform/
hardware.

Regards,
 
S

Sanchit

(please do not cross-post to this newsgroup - and note that there is no
such language as C/C++)

C++ does not have any notion of "printer" (nor of "screen", for that
matter), so there is no simple answer to this question. Printing is
*very* platform-specific. How you achieve what you want will certainly
depend on your machine, operating system, printing system, and printer.

You will be better off asking on forums dedicated to your platform/
hardware.

Regards,

I want to print in Windows using Turbo C++
 
S

Sylvester Hesp

Sanchit wrote :
I want to print in Windows using Turbo C++

Then search for a newsgroup regarding Windows and/or Turbo C++. This
newsgroup is about the C++ *language* so your question is offtopic
here.

- Sylvester
 
B

blufox

I dont want to clear screen... please read question clearly........

If you read it a little more clearly you 'll find it is not a C or C++
feature.
In other words C or C++ do not even know that there is a screen. So
this is irrelevant from C's point of view.

Check you OS docs for help.

PS: Learn to follow the advice.

Thanks
 
O

osmium

:

I want to print in Windows using Turbo C++

Did you try to find a forum dedicated to your platform? My guess is no, but
your platform is kind of atrophied by now, so I will grant you that it may
be difficult.

The easiest way is to create a text file when your program runs, and after
the file is closed, print the text file using whatever facilities your OS
provides. If that's not good enough, dig into the API for your operation
system.
 
J

jacob navia

Sanchit said:
I want to print a specific portion of output screen using a printer.
How can i do this using C/C++ commands???????

Thanks in advance

Under windows you can use the text mode APIs to read from the
screen the characters displayed.

Under linux, I think I remember that the curses library
provided a similar capability.
 
O

osmium

Sanchit said:
I undersatnd that this is not C/c++. But then where i can find a
solution

Do you think there is a single human being on this planet, other than
yourself, that can make any sense out of the post you made?
 
K

Kenneth Brody

jacob said:
Under windows you can use the text mode APIs to read from the
screen the characters displayed.

Assuming that you are talking about a console window in the
first place.
Under linux, I think I remember that the curses library
provided a similar capability.

But only if all output was done by the current process via the
curses library.

ie: no printf()s, nor anything output via system().

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 
M

Mark McIntyre

I want to print a specific portion of output screen using a printer.
How can i do this using C/C++ commands???????

Standard C (the topic of CLC) offers no facility to do this. You will
need to ask specialists in your operating system and/or compiler
platform, in a different group.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
M

Mark McIntyre

I undersatnd that this is not C/c++. But then where i can find a
solution

By asking in the RIGHT PLACE. You need to ask the experts in your
platform, not the experts in C.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
D

Das

I want to print a specific portion of output screen using a printer.
How can i do this using C/C++ commands???????

Thanks in advance

This is fully dependant on your setup. Nothing to do with C/C++.
If you use DOS and TURBO-C/C++ you can do it by using DOS.H.
If you are on Linux then it is difficult to do such a thing readily.
Under linux you have to port your code to CURSES/NCURSES, and you have
controll over the output.

Else if you are a very low level programmer then you can go to the
display buffer in your videocard
and manipulate. ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,197
Latest member
ScottChare

Latest Threads

Top