Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help to understand this specs

Status
Not open for further replies.

Lawin

Technical User
Feb 15, 2002
11
0
0
US
Need help to understand the specs.....I'm helping a friend to do his assignment however the specs are confusing. I talk to him about however his confuse too.

Specs:

int getline(char s[]) - copies the next line of clean text, stored in the object, into the character array, s, as a null-terminated string. A line always begins with a non-space character, and ends within the current line width without splitting a word, if possible.

The only situation in which a word will need to be split is the case where a line starts with a word that is too long to fit on the line. In this case, as much of the word as will fit is copied.

Note that the spaces separating the end of most lines from the beginning of the next are never copied.

This function also arranges things so that the next time it (or the similar function fwriteln() described below) is called, then it will obtain the next line after the line it just obtained.

This function returns the index, in the clean text stored by the object, of the first character in the next line to be output.

This function assumes that the array, s, is large enough to hold the line.

If the object is already positioned past its last line, then this function copies an empty string into s, and returns the index just after the last character of the clean text stored by the object.

Note that this function will not work properly unless the string and the width have been set (using set() or fread()). Note also that the width of a line can be changed between calls to getline() (or fwriteln()), in order to extract lines of different lengths as you move through the data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top