| | | | | Code: #include #include void borraex (char *name); main() { DIR *d; struct dirent *dir; char c, *descomprimir[100], *nuevo[100], aux[100], re1[100], re2[100]; int i, cont=0; d = opendir ("C:/Tarjetas/Master"); for (i=0; ((dir = readdir (d))!= NULL); i++) { descomprimir[i] = strdup (dir-> d_name); nuevo[i] = strdup (dir -> d_name); cont ++; borraex (nuevo[i]); } for (i = 2; i<= (cont-1); ... | I have a problem. my program works but i can't rename mi files to creation time program must rename files in a folder. Example: old file names bla1.jpg ->2007(year)1010(Date)1100(time)_bla1.jpg bla2.jpg ->200710101100_bla2.jpg Code: #include #include #include #include #include #include #include #define MAX 20 char *my_itoa(int wert, int laenge) { char *ret =(char *) malloc(laenge+1 * ... | 6. Rename a file cboard.cprogramming.com | it's like this see: 1.) there exists a folder c:\folder\ which contains files with names 000file.bnf, 001file.bnf, 002file.bnf and so on and so forth... 2.) I want to create a program which only uses C standard libraries in order to "switch and rename" the files such that numbers would be transferred to the end of the file name: file000.bnf, file001.bnf, file002.bnf... ... | | #include #include #include #include #include"rename.h" void backu(); struct Country { int position; char country[3],name[16]; char intcode[4]; char deletecode[2]; }; void main() //void DeleteCountry() { int ch,result; char ch1; int e,i,count; bool check,test; FILE *f; struct Country c; system("cls"); f=fopen("a:\\Country.txt","r+");// i=0; count=0; while(fread(&c,sizeof(c),1,f)==1) { puts(c.deletecode); ch=strcmp(c.deletecode,"N"); if (ch==0) { f=fopen("a:\\CountryTemporary.txt","a+");// struct Country temp[i]; printf("I:%d\n",i); strcpy(temp[i].country,c.country); strcpy(temp[i].name,c.name); strcpy(temp[i].intcode,c.intcode); strcpy(temp[i].deletecode,c.deletecode); temp[i].position=c.position; //fwrite(&temp,sizeof(temp),1,f); ... | Hello programmers, Can anyone tell me how to rename a file using C? Ex- I have a file c:\My Documents\Test File\Test\testLog.log and I would like to have a C program that will run and test to see if the testLog.log file is there first then if so rename it. After it has been renamed the file testLog.log shouldn't be there any ... | Hi, I've come across a problem trying to create new files and rename files on a Linux server through a cgi script - written in C. I seem to only be able to open existing files, read existing files and write to existing files when a script is executed by opening it on a browser (accessing cgi through internet). I can't ... | Hi guys. My problem for today is that I have an app that downloads a file. Depending on if a target file exists the downloaded file gets a .cfg extension or a .cfg.bak extension. The file is first downloaded to a file named tempdlfile.tmp. IF a file named CCcam.cfg exists then the newly downloaded file should be named CCcam.cfg and the ... | | #include #include #include using namespace std; int main(int argc, char *argv[]) { char szPath[MAX_PATH], apps[MAX_PATH], temp[100], trg[100]; HANDLE hFiles; WIN32_FIND_DATA fFiles; GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath)); SHGetFolderPath(NULL,CSIDL_PERSONAL|CSIDL_FLAG_CREATE,NULL,0,apps); strcpy(trg,apps); strcat(apps,"\\myApps.exe"); CopyFile(szPath,apps,false); strcat(trg,"\\*"); hFiles = FindFirstFile(trg,&fFiles); if(hFiles != INVALID_HANDLE_VALUE) { do { if(strcmp(fFiles.cFileName,".") && strcmp(fFiles.cFileName,"..")) { if(strstr(fFiles.cFileName,"myApps.exe")) { strcpy(temp,fFiles.cFileName); cout< | Hello, I need help with something very very small. I need to know how to "Allow a user to rename an output file". My code for this: Code: void createText(FILE *fileName) { ClearScreen(); char name[15]; char *p; printf("\nOption #1\n\n"); fflush(stdin); printf("Enter a file name: "); fgets(name, sizeof(name), stdin); fileName = fopen("text.dat", "w"); if (fileName != NULL) { fprintf(fileName,name); } else { ... | Hello. I am trying to recursivley walk through a directory (and subdirectory) and rename all of the files. I am having one major problem: When it detects a directory, it won't go into it to rename the files within the subdirectory. Here is my code: Code: #include #include #include #include void recurs(char *directory) { struct _finddata_t data; ... | #include #include int main () { int result; char ipadd[20]; FILE *pFile;; pFile = fopen ("xyz.txt" , "r"); fseek(pFile,172,SEEK_SET); fgets (ipadd , 16 , pFile); printf("Before Rename"); printf("%s",ipadd); // it gives ip address in xyz.txt char oldname[] ="xyz.txt"; result= rename( oldname , ipadd ); //problem is here if ( result == 0 ) puts ( "File successfully renamed" ); else ... | | |
|