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){
|
||||
line[i]=c;
|
||||
}
|
||||
else if(i==maxline-1){
|
||||
line[i]='\0';
|
||||
else if(i==maxline-2){
|
||||
line[i]='\n';
|
||||
line[i++]='\0';
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +32,9 @@ int main(){
|
|||
char longline[MAXLINE]; /* line to print */
|
||||
while ((len = ggetline(line, MAXLINE)) >0){
|
||||
copy(longline, line);
|
||||
printf("%s\n", longline);
|
||||
if (len>80){
|
||||
printf("%s\n", longline);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue