#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define charslongs 255
void w_char_m(char* words)
{
FILE* pf;
pf = fopen("multi_char.txt", "w");
fwrite(words, sizeof(char), sizeof(words), pf);
fclose(pf);
}
void r_char_m(char* buf)
{
FILE* pf;
pf = fopen("multi_char.txt", "r");
/* Seek to the beginning of the file */
fseek(pf, 0, SEEK_SET);
fread(buf, sizeof(char), sizeof(buf), pf);
fclose(pf);
}
int main()
{
char words[256];
char buf[256];
int i;
scanf("%s", words);
w_char_m(words);
r_char_m(buf);
printf("%s\n", buf);
return 0;
}
空格不能算字符串,这个每次只能存储一个单词,就很烦