[fpc-pascal] documentation for file handling, reset, rewrite, errors?
Michael Van Canneyt
michael at freepascal.org
Wed Feb 11 09:37:09 CET 2009
On Tue, 10 Feb 2009, Ken G. Brown wrote:
> I cannot seem to find the good docs for the file handling routines assign, rewrite and reset in the pdf's that came with fpc-2.2.2. Where might the best ones be?
> I have:
> User's Manual.pdf
> Units Reference Guide.pdf
Normally, the routines are documented here.
> Programmer's Manual.pdf
> Language Reference Guide.pdf
> Free Component Library.pdf
> Compiler Switches.pdf
> Code Documented.pdf
>
> I would like to find good descriptions of how they work, along with error handling and examples of how
> to how to best use them.
>
> eg. can an internal memory based file be set to be written and read at the same time?
Yes.
> Is the file read position independent of the write position?
This kind of thing is not explained.
>
> If the internal file has been written to the end and the write operation is finished but
> the file is still open for writing, what needs to be done in order to start reading the file from the beginning?
With standard file I/O, this is not possible.
>
> Are streams available for reading and writing and are they preferable to while not eof (inFi) read(inFi)
> then write(outFi)?
They are.
>
> Are exceptions useful?
Yes :-)
>
> Examples?
>
> My goal is to create an internal file then dump it to a system usb printer.
>From your questions, I think you're better off using TMemoryStream and class
based programs. They're more flexible than the standard Pascal file I/O.
>
> I've found an example of writing to a pipe using assignlst (f,'|/usr/bin/lpr -m'); that seems to sorta work,
> from here: <http://ubuntuforums.org/showthread.php?t=656110>, 2nd message.
> Is that a good way to do output to a printer?
On linux/unix there is no other reliable way.
Michael.
More information about the fpc-pascal
mailing list