07/02/25 23:20:03
>>176
#include<windows.h>
#include<stdio.h>
int func1(void){
HANDLE h_find;
WIN32_FIND_DATA file_info;
printf("\n----- func1 -----\n");
h_find=FindFirstFile("*", &file_info);
if(h_find==NULL) return 0;
do{
printf("%s\n", file_info.cFileName);
}while(FindNextFile(h_find, &file_info)==TRUE);
FindClose(h_find);
return 1;
}
int func2(void){
FILE *fp;
char filename[FILENAME_MAX];
printf("\n----- func2 -----\n");
fp=popen("dir /b", "r");
if(fp==NULL) return 0;
while(fgets(filename, sizeof(filename), fp)!=NULL)
printf("%s", filename);
fclose(fp);
return 1;
}
int main(void){
func1();
func2();
return 0;
}