Use fgetc in while loops, use int instead of char

This commit is contained in:
David Crosby
2015-07-25 22:47:24 -06:00
committed by Tatsuya Kinoshita
parent 6eb7866442
commit c162b75317

14
Str.c
View File

@@ -530,11 +530,8 @@ Str
Strfgets(FILE * f)
{
Str s = Strnew();
char c;
while (1) {
c = fgetc(f);
if (feof(f) || ferror(f))
break;
int c;
while ((c = fgetc(f)) != EOF) {
Strcat_char(s, c);
if (c == '\n')
break;
@@ -546,11 +543,8 @@ Str
Strfgetall(FILE * f)
{
Str s = Strnew();
char c;
while (1) {
c = fgetc(f);
if (feof(f) || ferror(f))
break;
int c;
while ((c = fgetc(f)) != EOF) {
Strcat_char(s, c);
}
return s;