Component index
Section index

Component savefile


	    savefile is a simple component to update files.
	static void sample_savefile()
	    // We just overwrite the content
	    <call savefile>("/tmp/x.log",false);
	    <f dowrite>
	        // savefile does the sanity check and call us with a FILE handle
	        fprintf (fout,"This is the content\n");
	    // We add a few lines
	    <call savefile>("/tmp/x.log",true);
	    <f dowrite>
	        fprintf (fout,"This is more content\n");
	    <f openfail>
	        tlmp_error ("Can't append to /tmp/x.log\n");
	    <f end>
	        printf ("File /tmp/x.log was updated\n");
	    <f start>
	        // Ok, the file is open in append mode. dowrite will be called
	        printf ("Start the update\n");