fixed 1-17 being wrong and unfinished
This commit is contained in:
parent
9e40e33700
commit
39604128b6
9
1-17.c
9
1-17.c
|
@ -8,8 +8,9 @@ int ggetline(char line[], int maxline){
|
||||||
if(i<maxline-2){
|
if(i<maxline-2){
|
||||||
line[i]=c;
|
line[i]=c;
|
||||||
}
|
}
|
||||||
else if(i==maxline-1){
|
else if(i==maxline-2){
|
||||||
line[i]='\0';
|
line[i]='\n';
|
||||||
|
line[i++]='\0';
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +32,9 @@ int main(){
|
||||||
char longline[MAXLINE]; /* line to print */
|
char longline[MAXLINE]; /* line to print */
|
||||||
while ((len = ggetline(line, MAXLINE)) >0){
|
while ((len = ggetline(line, MAXLINE)) >0){
|
||||||
copy(longline, line);
|
copy(longline, line);
|
||||||
printf("%s\n", longline);
|
if (len>80){
|
||||||
|
printf("%s\n", longline);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue