CS Behind the Curtain (CS195 2003S)
Primary:
[Front Door]
[Current]
[Glance]
-
[Blurb]
[Disabilities]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Walker/Fall 2001]
[SamR]
Back to Reading Lines (1). On to Semantics of Conditionals.
Held: Tuesday, 1 April 2003
Summary: Today we continue our investigation of the steps involved in reading a line from a file. We also consider other issues from exam 1.
Related Pages:
Overview:
readLine, continued.readLine.strncpy.readLine, ContinuedreadLine, ContinuedreadLinereadLine, based on some different
things various of you did. We'll critique it together and then
try to fix it.
int
readLine(FILE *file, char string[], int max) {
char c;
int i;
for(i = 0; ((c=getc(file))!=EOF) && (c != '\n') && (i < max-1); i++)
string[i] = c;
string[i++] = '\0';
if (i >= max)
return 0;
else if (c == EOF)
return 1;
else if (c == '\n')
return 1;
else
return 0;
} /* readLine(FILE *, char[], int) */
extramultiplications
strncpyBack to Reading Lines (1). On to Semantics of Conditionals.
Primary:
[Front Door]
[Current]
[Glance]
-
[Blurb]
[Disabilities]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Walker/Fall 2001]
[SamR]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Fri May 2 14:20:52 2003.
The source to the document was last modified on Mon Jan 20 12:41:04 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS195/2003S/Outlines/outline.34.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby