473,472 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Line wrapping in ostream

Hi,

Are there ready solutions for auto-wrapping lines in ostream?

I am using ostream for output and want this output to be wrapped at some
position. Of course I can monitor stream pointer position and insert
end-of-lines periodically. Something better than that?

Alex

Jul 19 '05 #1
2 2449


Alex Dribin wrote:

Hi,

Are there ready solutions for auto-wrapping lines in ostream?

I am using ostream for output and want this output to be wrapped at some
position. Of course I can monitor stream pointer position and insert
end-of-lines periodically. Something better than that?


You want to equip the stream object with a custom stream buffer.
Search the newsgroup comp.lang.c++ for posts from Dietmar Kuehl.
He has posted examples of how to write stream buffer classes
in the past.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 19 '05 #2
Alex Dribin <no****@nospam.net> wrote:
Are there ready solutions for auto-wrapping lines in ostream?
Dunno.
I am using ostream for output and want this output to be wrapped at some
position. Of course I can monitor stream pointer position and insert
end-of-lines periodically. Something better than that?


Create a stream buffer whose buffer happens to be the maximum size of your
line. On buffer overflow you just search the buffer up to the first newline
and sent this portion, moving the remainder to the front of the buffer. If
there is no newline, you jsut sent the whole buffer followed by a newline
and emptying the buffer.

This stream buffer is probably a filtering stream buffer and would take
something like maybe 20 lines. Together with a few convenience classes you
will have something like 50 lines.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>
Jul 19 '05 #3

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

Similar topics

12
by: scott | last post by:
Is there a way to prevent IE from forcing a line break? Below in LISTING 2, you notice the table background image extention of '.jpg' begins a new line, instead of staying on the same line as it's...
1
by: mg | last post by:
I set the width of a WebForm Label but do not get line wrapping (see below). What can I do to get line wrapping WebForm1.asp <asp:Labe id="Label1" style="Z-INDEX: 101; LEFT: 40px; POSITION:...
2
by: Amelyan | last post by:
If I have spaces in my Text property of Label, and I add it to TableCell, it wraps at spaces. E.g. Label lb = new Label(); lb.Text = "Hello, World!" TableCell cell = new TableCell();...
4
by: Danie | last post by:
I need to use drawstring, but it always draws one line, and I need to divide it. to give it a specified width which it doesnt cross, but starts another line. is it possible? thanks daniel
7
by: S Borg | last post by:
Hello, I am parsing text from one document to another. I have a scheme similar to: for x in myfoobar: print >> mytextfile, "%s " % mydictionary, #all on same line print >> mytextfile,...
6
by: Markus Ernst | last post by:
Hi Searching for a possibility to display some text with preserved white space and line breaks, but with long lines being wrapped, I found this CSS declaration, which I found helpful: pre {...
7
by: John den Haan | last post by:
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.