Tag: strchr

C用换行符分析逗号分隔值

我有一个CSV数据文件,其中包含以下数据: H1,H2,H3 a,"b c d",e 当我通过Excel打开CSV文件时,它可以显示列标题为H1, H2, H3和列值的表格: a for H1 , multi line value as b c d for H2 和c for H3我需要parsing这个文件使用C程序,并有这样的价值拾起。 但是,我的下面的代码片段将无法正常工作,因为我有一个列的多行值: char buff[200]; char tokens[10][30]; fgets(buff, 200, stdin); char *ptok = buff; // for iterating char *pch; int i = 0; while ((pch = strchr(ptok, ',')) != NULL) { *pch = […]