04-08-2007, 07:01
|
|
|
|
חבר מתאריך: 08.10.02
הודעות: 827
|
|
אני מניח שאתה מתכוון לקריאה מקובץ לתוך string, אם כן
קוד:
FILE *fp = fopen("1.txt", "r");
if (fp == NULL) { printf("Could not open 1.txt\n"); exit(1); }
char string[1024];
int len = fscanf(fp, "%s", string);
if (len > 0) {
printf("Read(%d chars): %s", string);
}
fclose(fp);
_____________________________________
Error: Keyboard not found
Press F1 to continue
|