Created
December 1, 2010 15:19
-
-
Save anonymous/723622 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define BUFFERSIZE 1000 | |
| int main(void) | |
| { | |
| FILE * pFile_Read1 = NULL; | |
| FILE * pFile_Read2 = NULL; | |
| char buffer[BUFFERSIZE] = {0}; | |
| char buffer2[BUFFERSIZE] = {0}; | |
| pFile_Read2 = fopen("D:\\a\\123.txt", "r"); | |
| if ( pFile_Read2 == NULL ) | |
| { | |
| printf("讀取失敗\n"); | |
| } | |
| else | |
| { | |
| while( feof(pFile_Read2) == 0 ){ | |
| fscanf(pFile_Read2,"%s",buffer); | |
| printf("%s\n", buffer); | |
| pFile_Read1 = fopen(buffer,"r"); | |
| fgets(buffer2, BUFFERSIZE, pFile_Read1); | |
| fgets(buffer2, BUFFERSIZE, pFile_Read1); | |
| fscanf(pFile_Read1,"%s",buffer2); | |
| printf("%s\n", buffer2); | |
| fclose(pFile_Read1); | |
| } | |
| fclose(pFile_Read2); | |
| system("PAUSE"); | |
| return 0; | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment