我正在尝试将字符文件读入 64 个字符的数组。文件读取发生在main()
int main (int argc, char **argv)
{
FILE *fp;
char write_msg[BUFFER_SIZE];
fp = fopen("test.data", "r");
int i;
for ( i = 0; i < (BUFFER_SIZE-1); i++){
fscanf(fp, "%s\n", &write_msg[i]);
printf ("printing in the for loop");
}
fclose(fp);
printf("Starting the main().\n");
printf("in Reader, the msg is: %s\n",write_msg);
pid_t pid;
int fd[2];
我不断收到段错误,我不确定我在做什么