All I want is to read a *.c file, remove the header, change the header and save the file of course in *.c format. I used “fprintf”, the problem is in the *.c file there is some printf with “\n”, and the fprintf interpretes it like a new line :(, I ended up with a broken *.c file.
Is there a way to handle *.c files with matlab commands ?
All I want is to read a *.c file, remove the header, change the
Share
Once you have read the file, you should replace the
\character with\\, which will be converted back to\when writing again to file.strrepis great for this:(note that
fprintfwithout file identifier prints to command line. Very useful for debugging)