Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Edit xml File with fopen and fprintf
Posted:
Dec 25, 2012 4:57 AM
|
|
I have xml file with few strings rows I used fopen to open the original file, fopen('w') to open new file and fprintf to print all line from original file to new file as one can see below.
The problem is that when I open the new file with notepad I get messy text, instead of rows I get long text with spaces when I open it with notepad++ then the text is organize by rows exactly as in the original file.
Which function I shall use in order to get exactly the same text structure?
Function Code:
FidOldFile = fopen([PathName,'\',FileName]); FidNewFile = fopen([PathName,'\',NewFileName],'w'); tline = fgetl(FidOldFile); while ischar(tline) fprintf(FidNewFile,'%s\n',tline); tline = fgetl(FidOldFile); end
|
|
|
|