Home > Back-end > How can the c language statistics how many Spaces, every row in the file and keep only the first row
How can the c language statistics how many Spaces, every row in the file and keep only the first row
Time:10-14
C language classes have encountered problem, need to do a word learning system, I think the first step is to use fscanf reads TXT file to structure to words and Chinese meanings in the array, the file is each word and its meaning in Chinese a line together, there is a space between the words and meaning, but some words is there are two different parts of speech in Chinese meaning, so there are two Spaces between a line, I can't to save both Chinese and English respectively when using the fscanf structure, also can't undertake after query and learning functions, Want to one night all don't know what to do, file has nearly 4000 words, if one will be the one in the file space delete it too time-consuming, want to ask is there any great god has a solution,
CodePudding user response:
?? Put the wrong picture, the first picture is wrong
CodePudding user response:
save the children
CodePudding user response:
Each read a line and then find the first position of the space, the space into a '\ 0', this line is divided into two parts