The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM



Thread: I can print ""
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 04-18-2008
DreamWarrior DreamWarrior is offline
Registered User
 

Join Date: Oct 2003
Posts: 69
Can I ask why you are using the system call from C to write to a file in the first place? You do realize that there exists a slew of API calls that are much more efficient than creating a new process to write a single line of text to a file.

Code:
FILE *fp;

fp = fopen("a.xml", "wt");
fprintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fclose(fp);
Would be much better and you can even continuing writing XML to file instead of closing it.
Reply With Quote