RosettaCodeData/Task/File-size/XPL0/file-size.xpl0

16 lines
375 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
proc ShowSize(FileName);
char FileName; int Size, C;
[Trap(false); \disable abort on error
FSet(FOpen(FileName, 0), ^i);
Size:= 0;
repeat C:= ChIn(3); \reads 2 EOFs before
Size:= Size+1; \ read beyond end-of-file
until GetErr; \ is detected
IntOut(0, Size-2);
CrLf(0);
];
[ShowSize("input.txt");
ShowSize("/input.txt"); \root under Linux
]