
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
Hi,
I was wondering if you could update a text file in C in read/write
mode (r+)
I want to do something like this
void uppercase(char *fname) {
FILE *fp;
int c;
fp=fopen(fname,"r+");
if(fp==NULL) {
printf("Unable to open file %s\n",fname);
exit(1);
}
while((c=fgetc(fp))!=EOF)
fputc(toupper(c),fp);
fclose(fp);
}
(I know this will not work, but is there anyway I can achieve this
functionality of updating a text file in r+ mode. I DONT WANT to copy
the contents of the text file to a temp file and then process the temp
file, rename the temp file to fname and finally delete the original
file.
Please help me.
Thanks,
Rajiv
--
comp.lang.c.moderated - moderation address: [EMAIL PROTECTED]
| <-- __Chronological__ --> | <-- __Thread__ --> |