我有我想刪除空格的句子,但我正在閱讀文本文件。這裏的詞的樣本:刪除句子之間的空格。
the tree hugged the man
there are many trees
where are the bees
所以它應該是:
thetreehuggedtheman
therearemanytrees
wherearethebees
這裏是我到目前爲止有:
int main(int argc, char* argv []) {
int i = 0, line = 6;
char word[100];
char const* const fileName = argv[1];
FILE *file = fopen(fileName,"r");
while(line--){
fgets(word, 100, file);
i++;
char *wordRev = reverse(word);
// Remove spaces from string here
}
fclose(file);
return 0;
}
「reverse」與刪除空格有什麼關係? – Lundin