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

28 lines
659 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)
{
U8 f=0;
Ltf *l=LtfNew;
GetFFlags(&f,SysText("ST_FILE_UTIL_FLAGS"),"+r");
LtfPutSExt(l,"$$TR -C+AL,\"\"$$\r\n");
LtfPutSExt(l,"$$ID,+2$$");
TreeSub(l,FindFiles("/LT/*",f));
LtfPutSExt(l,"$$ID,-2$$");
LtfRecalc(l);
if (output_filename) {
StrCpy(l->filename.name,output_filename);
LtfWrite(l,FALSE);
} else
LtfWrite(l,TRUE);
LtfDel(l);
}
FPrintFDemo;