我正在处理一个文件。我想取每一行并在空格后分割。例如,如果 line1 有:今天是星期一我想要今天,是,星期一分开,以便处理它们
到目前为止,这是我的代码:
FILE *file = fopen ( "file1", "r" );
if ((file != NULL ))
{
char line [ 128 ];
while( ( fgets ( line, sizeof line, file ) != NULL ))
{
//tokenize the line based on space
??
}
how to add text at the end of the line? i mean i have **today is monday** and i want to add for example **Yupppy** at the end of today is monday line.
fclose ( file );
}