473,217 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,217 software developers and data experts.

disable putchar line-wrapping?

Hello!

When I use putchar to fill up an entire screen (of 80x25) with text, it
seems to leave an empty line at the end, thus forcing me to scroll
upwards in to see the first line. This forces me to repositioning the
cursor to the first line, which costs computer power. I know the loss is
negligible, but it's more a matter of principle: how to prevent this
line-wrapping behaviour?

--

Cheers,

John den Haan
joDhn[dot]haEan[at]chLello[dot]nl

Remove capital 'DEL' from above addy to obtain e-mail address
Feb 18 '07 #1
7 2406
John den Haan wrote:
Hello!

When I use putchar to fill up an entire screen (of 80x25) with text, it
seems to leave an empty line at the end, thus forcing me to scroll
upwards in to see the first line. This forces me to repositioning the
cursor to the first line, which costs computer power. I know the loss is
negligible, but it's more a matter of principle: how to prevent this
line-wrapping behaviour?
In standard C, it's simply not possible, sorry. A newsgroup for your
specific system may be able to give a system-specific answer.

Feb 18 '07 #2
Harald van Dijk schreef:
John den Haan wrote:
>Hello!

When I use putchar to fill up an entire screen (of 80x25) with text, it
seems to leave an empty line at the end, thus forcing me to scroll
upwards in to see the first line. This forces me to repositioning the
cursor to the first line, which costs computer power. I know the loss is
negligible, but it's more a matter of principle: how to prevent this
line-wrapping behaviour?

In standard C, it's simply not possible, sorry. A newsgroup for your
specific system may be able to give a system-specific answer.
Does C offer alternatives to putchar that do not wrap?

--

Cheers,

John den Haan
joDhn[dot]haEan[at]chLello[dot]nl

Remove capital 'DEL' from above addy to obtain e-mail address
Feb 18 '07 #3
John den Haan wrote:
Harald van Dijk schreef:
>John den Haan wrote:
>>Hello!

When I use putchar to fill up an entire screen (of 80x25) with text, it
seems to leave an empty line at the end, thus forcing me to scroll
upwards in to see the first line. This forces me to repositioning the
cursor to the first line, which costs computer power. I know the loss is
negligible, but it's more a matter of principle: how to prevent this
line-wrapping behaviour?


In standard C, it's simply not possible, sorry. A newsgroup for your
specific system may be able to give a system-specific answer.

Does C offer alternatives to putchar that do not wrap?
Standard C does not provide a means to determine the properties of the
standard output. You have to use an platform specific library.

--
Ian Collins.
Feb 18 '07 #4
In article <d7***************************@news.chello.nl>,
John den Haan <no****@nospam.comwrote:
>Does C offer alternatives to putchar that do not wrap?
It isn't putchar() that is doing the wrapping: it is the terminal
emulation layer that the text is being displayed on to. There might
or might not be a way to control the wrapping behaviour of that
emulation layer, but if there is, then it is specific to that emulation
layer and not part of C. You'll probably find there are different
terminal emulation behaviours for different products even for the same OS,
so this really isn't something we can answer here.
--
If you lie to the compiler, it will get its revenge. -- Henry Spencer
Feb 18 '07 #5
John den Haan <no****@nospam.comwrites:
When I use putchar to fill up an entire screen (of 80x25) with text,
it seems to leave an empty line at the end, thus forcing me to scroll
upwards in to see the first line. This forces me to repositioning the
cursor to the first line, which costs computer power. I know the loss
is negligible, but it's more a matter of principle: how to prevent
this line-wrapping behaviour?
You didn't tell us *how* you use putchar to fill up the screen.

Do you write a newline character at the end of each of the 25 lines?
If so, on a typical display, the last newline will naturally cause the
disply to scroll up, leaving the cursor at the beginning of a blank
line.

If you print characters without a terminating newline, you should call
fflush(stdout) to ensure that they're displayed. (But some displays
may not be able to display a character in the lower right corner.)

Details of how displays work are target-specific, but we'll be glad to
help with any C issues.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 18 '07 #6
Keith Thompson wrote:
John den Haan <no****@nospam.comwrites:
>When I use putchar to fill up an entire screen (of 80x25) with text,
it seems to leave an empty line at the end, thus forcing me to scroll
upwards in to see the first line. This forces me to repositioning the
cursor to the first line, which costs computer power. I know the loss
is negligible, but it's more a matter of principle: how to prevent
this line-wrapping behaviour?

You didn't tell us *how* you use putchar to fill up the screen.

Do you write a newline character at the end of each of the 25 lines?
If so, on a typical display, the last newline will naturally cause the
disply to scroll up, leaving the cursor at the beginning of a blank
line.

If you print characters without a terminating newline, you should call
fflush(stdout) to ensure that they're displayed. (But some displays
may not be able to display a character in the lower right corner.)

Details of how displays work are target-specific, but we'll be glad to
help with any C issues.
Whew. At last a sane answer to the query. But remember that
fflush only flushes the C system buffers - there may be (on poor
implementations) further op-system buffers to flush.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
Feb 19 '07 #7
>When I use putchar to fill up an entire screen (of 80x25) with text, it
>seems to leave an empty line at the end, thus forcing me to scroll
upwards in to see the first line. This forces me to repositioning the
cursor to the first line, which costs computer power.
Your posting probably used millions of times more than the picowatt
required to do that.
>I know the loss is
negligible, but it's more a matter of principle: how to prevent this
line-wrapping behaviour?
C doesn't guarantee that you have a screen, or that it will scroll
(ASR-33 Teletype anyone?).

For some terminals and/or terminal emulations, writing the character
at the bottom right of the screen scrolls the screen, and there's
not anything you can do about it. Sometimes there's a mode you can
turn on or off which makes it either scroll or wrap to the upper
left corner.

In the implementation of some versions of curses, and for some terminals,
you can set the bottom-right character using the following ugly hack:
(1) move the cursor to one left of the bottom-right character
(Direct cursor positioning if you've got it)
(2) write the character you want at the bottom-right there
(yes, this is one space off)
(3) move the cursor to one left of the bottom-right character
(same place as (1); often a cursor-left sequence will work)
(4) send a sequence to enable insert-character mode
(5) write the character you want to the left of the bottom-right there
This moves the character that was there one to the right.
(6) send a sequence to disable insert-character mode

Note that in order to change the bottom-right character, you have
to know what you want in the character to the left of it. No, you
can't depend on reading the screen, especially if the user is busy
entering data on the keyboard. Since curses keeps an image of how
it wants the whole screen to look anyway, this is not a problem.

Curses can use this sort of hack when necessary without the user
of curses having to deal with it.

Feb 19 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: MasonC | last post by:
I find I cannot disable javascript in MSIE 6 I've Help'd, Google'd, and searched here to no avail. <noscript> You don't have javascript enabled </noscript> will not display for me. ...
10
by: Craig | last post by:
I'm a beginner with JS. When I try to disable JavaScript in IE6, I can't seem to turn it off in order to do off-line tests -- with or without JS enabled -- on my developing site. What I try in...
5
by: Confused User | last post by:
I am working on device that utilizes a Motorola 68HC16 microcontroller. I am using an old unsupported piece of crap Whitesmith's / Intermetrics / Tasking compiler. The embedded compiler business...
1
by: Philip Bondi | last post by:
Hello to all SQL Server junkies who work with non-English characters: For people running scripts from the command line using ANSI files with special characters, it is very important to use isql...
5
by: Ike | last post by:
Does anyone know how to disable a list box element in VB 6 ? Thanks Ike
19
by: RedDevilDan | last post by:
I am working on a Memory Footprint Reduction project. I came across an idea to disable all printf statements so that less memory is required. In addition, when there is no single printf statement,...
1
by: martin paul | last post by:
Sir please consider the following question and code. 1) printing a integer variable 'a' having value less than 1000. putchar( (a/100) + ' 0 ' ); a=a%100; putchar( (a/10) + ' 0...
37
by: Vince C. | last post by:
Hi all. I've installed Bloodshed Dev-C++ on a Windows 2000 SP4 machine. I'm using MinGW 3.4.2. I'd like to temporarily disable standard functions to write to stderr, i.e. for instance...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? -----------------------------------------------------------------------...
9
by: anon.asdf | last post by:
In terms of efficieny: Is it better to use multiple putchar()'s after one another as one gets to new char's OR is it better to collect the characters to a char-array first, and then use...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.