思维导图
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <semaphore.h>
#include <wait.h>
#include <signal.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <semaphore.h>
#include <sys/msg.h>
#include <sys/shm.h>
#include <sys/un.h>
#include <dirent.h>
typedef struct sockaddr_in addr_in_t;
typedef struct sockaddr addr_t;
typedef struct sockaddr_un addr_un_t;
int main(int argc, const char *argv[])
{
DIR* dp=opendir("./111");
if(dp==NULL){
perror("opendir");
return 1;
}
char ch[32]={0};
while(1){
struct dirent* file=readdir(dp);
if(file==NULL){
break;
}
int ds=open("222.txt",O_WRONLY|O_CREAT|O_TRUNC,0666);
write(ds,ch,sizeof(ch));
close(ds);
}
return 0;
}