Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Change the file extension using C (http://www.go4expert.com/forums/change-file-extension-using-c-t8485/)

dearimranz 26Jan2008 20:29

Change the file extension using C
 
Hi there,

I am working on a project where I need to change the extension of file using C. For example I want to change a ".dat" file and write it in the form of ".txt" file.

Can someone help me with this. I will be very thankful.

,,,

shabbir 26Jan2008 21:24

Re: Change the file extension using C
 
Moved to C-C++ forum for better response.

Salem 27Jan2008 14:09

Re: Change the file extension using C
 
C doesn't care about file extensions.

Code:

FILE *in = fopen("file.dat","rb");
FILE *out= fopen("file.txt","w");

Then you can do whatever you want to read from the .dat file, and write to the .txt file.


All times are GMT +5.5. The time now is 04:03.