Files
TempleOS-Rijn/LT/DEMO/FPrintF.CPZ
T
2018-09-08 21:45:17 +02:00

28 lines
652 B
Plaintext

/* There is no FPrintF type function and no
way to grow files. Therefore, use memory to
hold the file until you are done. The Ltf
framework is convenient for this.
*/
#include "/LT/DEMO/TreeDemoJoin"
void FPrintFDemo(I1 *output_filename=NULL)
{
FlagsStruct f;
Ltf *l=LtfNew;
GetFFlags(&f,"ST_FILE_UTIL_FLAGS","+r");
LtfPutS(l,"$$TR -C+AL,\"\"$$\r\n");
LtfPutS(l,"$$ID,+2$$");
TreeSub(l,FindFiles("/LT/*",&f.on));
LtfPutS(l,"$$ID,-2$$");
LtfRecalc(l);
if (output_filename) {
StrCpy(l->filename.name,output_filename);
LtfWrite(l,FALSE);
} else
LtfWrite(l,TRUE);
LtfDel(l);
}
FPrintFDemo;