472,365 Members | 1,234 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to display a string in many lines, each lines have a specified length

Hi you!!

I am programming a part of my application and I met a trouble in
display test.

I used fgets to read each line in a text file and display all lines on
the screen. But the size of the window are too small to display all the
line(208,320), So can I ask you how to divide split a string(a line in
file) into many lines and dis play them on the screen so that all the
characters of the string would be displayed fully.
I am looking forward to your support!!

Can you contact me via my email: th*****@dsp.com.vn

Sincerely and thanks,

Thanh Thuy

Dec 6 '05 #1
1 1531
th*****@dsp.com.vn wrote:
Hi you!!

I am programming a part of my application and I met a trouble in
display test.

I used fgets to read each line in a text file and display all lines on
the screen. But the size of the window are too small to display all the
line(208,320), So can I ask you how to divide split a string(a line in
file) into many lines and dis play them on the screen so that all the
characters of the string would be displayed fully.
I assume you are using some kind of "console" window for your
application. A console usually wraps the text if it extends past the
end of the line.

However, you may get a substring of the length you want:

# include <string>
# include <iostream>

int main()
{
std::string s("a long long long line");
std::cout << s.substr(0, 10); // prints "a long lon"
}

And you can "pause" by adding a

std::cin.get();

whenever X lines are printed.
Can you contact me via my email: th*****@dsp.com.vn


No. Post here, read here.
Jonathan

Dec 6 '05 #2

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

Similar topics

9
by: Derek Hart | last post by:
I wish to execute code from a string. The string will have a function name, which will return a string: Dim a as string a = "MyFunctionName(param1, param2)" I have seen a ton of people...
16
by: Khuong Dinh Pham | last post by:
I have the contents of an image of type std::string. How can I make a CxImage object with this type. The parameters to CxImage is: CxImage(byte* data, DWORD size) Thx in advance
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
15
by: Daren | last post by:
Hi, I need to be able to split large string variables into an array of lines, each line can be no longer than 70 chars. The string variables are text, so I would additionally like the lines...
33
by: genc_ymeri | last post by:
Hi over there, Propably this subject is discussed over and over several times. I did google it too but I was a little bit surprised what I read on internet when it comes 'when to use what'. Most...
13
by: Freaker85 | last post by:
Hello, I am new at programming in C and I am searching a manner to parse a string into an integer. I know how to do it in Java, but that doesn't work in C ;o) I searched the internet but I...
2
by: AZRebelCowgirl73 | last post by:
Crazy as this sounds this program is actually working! I know I know it is amazing I got one to run. The only problem I am having is I want it to say for output line (1,2 3 etc.) has a length...
2
by: dmk | last post by:
Hi Again, I am reading a document into a page and then displaying it as source code (this is for an assignment.) I feel that the output that I am getting is a little hard to read, and want to...
2
Claus Mygind
by: Claus Mygind | last post by:
I have an array of objects (a hash table). My section of code, the "for in" loop (lines 18 to 41) does not execute at full speed. But if I put in an alert box (line 13) to stop program execution...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.