writing log files or config files uses fprintf | c/c++ programming by examples
To write formatted string to files, the easiest way is uses fprintf. It works exactly the same way like printf. FILE * fp=fopen("filename","w"); fprintf(fp,"%s.%s = %d\n", szTag,szSubTag,nValue); fclose(fp); In case you want to create your own fprintf...