更新时间:2023-09-18 08:54:58
这样H2CO3已经提到的,你可以使用线路长度为这样的:
而(函数getline(安培;线,&安培; line_size,F)!= -1){ 如果(strlen的(线)== 1){
的printf(H2CO3看准一个空行\\ n);
} / *或*交替/
如果('\\ n'==行[0]){
的printf(埃德效治疗术也看准空行\\ n);
} ..
}
while(getline (&line, &line_size, f) != -1){}
I'm using this function to read line line. But i want to know when i'm reading a blank line. Can someone help?
so as H2CO3 already mentioned you can use the line length for this:
while (getline (&line, &line_size, f) != -1) {
if (strlen(line) == 1) {
printf("H2CO3 spotted a blank line\n");
}
/* or alternatively */
if ('\n' == line[0]) {
printf("Ed Heal also spotted the blank line\n");
}
..
}