GetActiveWindow
GetForegroundWindow
GetFocus
GetTopWindow
int i=0; FILE *fp=fopen("C:\\test.txt","r"); char buf[32]; char newname[32][1024]; char newstr[16]="-Hello"; for (i=0; i<16; i++) { strncat(newname[i], newstr, sizeof(newstr)); //printf("%s\n",newname[i]); } i=0; while(fgets(buf, sizeof(buf)-11, fp)!=NULL) //-12 // fgets(buf, sizeof(buf)-12, fp); { strncat(buf, newname[i], sizeof(newname[i])); printf("%s\n",buf); ++i; } //printf("%s\n",buf); system("pause");
-------------------------------
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> int main (void) { int i=0; int cont=0; char *path_new=(char *)malloc(sizeof(char)*128); char *path_old=(char *)malloc(sizeof(char)*128); char *newname=(char *)malloc(sizeof(char)*1024); char newstr[16]="arm-linux-"; DIR *dir; struct dirent *ptr; strncpy(path_new, "/home/ecs/test/t2/", 128); strncpy(path_old, "/home/ecs/test/t2/", 128); dir =opendir("/home/ecs/test/t2"); while((ptr = readdir(dir))!=NULL) for(cont=0;(ptr=readdir(dir))!=NULL;cont++) { if(!strcmp(ptr->d_name, ".") || !strcmp(ptr->d_name, "..")) continue; memset(newname, '\0', 1024); memset(path_old, '\0', 128); memset(path_new, '\0', 128); strncat(newname, newstr, sizeof(newstr)); strncat(newname, (ptr->d_name)+23, 64); strncat(path_old, ptr->d_name, 64); strncat(path_new, newname, 64); printf("%s\n",path_old); printf("%s\n",path_new); } free(path_new); free(path_old); free(newname); closedir(dir);
沒有留言:
張貼留言