10.06.2016 Views

eldo_user

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Eldo Control Language<br />

Library of Functions for Tasks<br />

fgets<br />

Task function category: Functions Operating on Files<br />

Returns the next characters from the file represented by the file variable FILE, or EOF if the end<br />

of the file has been reached. It has the same behavior as the C fgets function: the function stops<br />

reading when NB_CHARS characters have been read or if a \n character is read (in which case,<br />

\n is the last character of the returned string).<br />

Usage<br />

fgets(FILE, NB_CHARS)<br />

Arguments<br />

• FILE<br />

File variable.<br />

• NB_CHARS<br />

Number of characters.<br />

Examples<br />

Example 1:<br />

.define_task read_file<br />

set myfile = NULL<br />

set s = ""<br />

myfile = fopen ("./hello.txt", "r")<br />

while(1)<br />

s = fgets(myfile, 200)<br />

if (s == EOF)<br />

break<br />

else<br />

printf(stdout, "%s", s)<br />

endif<br />

endwhile<br />

fclose (myfile)<br />

.end_define_task<br />

Example 2:<br />

900<br />

Eldo® User's Manual, 15.3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!