[fpc-pascal]How to assign a file? Please help

Tobias Hermann tobih at mayn.de
Wed Feb 14 09:41:55 CET 2001


if you use FILE as type,you have to set the record size to 1:

reset(fin, 1);

the default record size is 128 bytes...

Tobi

----- Original Message -----
From: Martin Hankovec <Martin.Hankovec at oku-st.cz>
To: <fpc-pascal at lists.freepascal.org>
Sent: Wednesday, February 14, 2001 9:05 AM
Subject: [fpc-pascal]How to assign a file? Please help


> Hello,
> I've a problem:
> I'm writing simple routine for copying files (it's in documentation too).
>
> If the type of variable for statement 'assign' is TEXT - it's OK. 'Reset'
> opens it, 'close' closes it even for many files.
>
>  B U T
> If it's 'FILE' like in example in doc, and I try to copy more files, it
crashes
> on error - too much files are opened. And I use only Assign,Reset and
Close!
> So after 'close' on filetype 'FILE' it is still opened ?!!!
>
> Fragment:
> ...
> Var
>     Fin,fout : text;
> begin
>   Assign (Fin,name);
>   Reset(Fin);
>  ....
>   close (fin);
> end;
>
> This works on many files OK. If I change it to
> Fin,fout: file;
> after 5 proofs it will crash (5 is the maximum of simultaniously opened
files
> under my Win NT)
> I have the ver. 1.0.2 of compiler.
>
> Can anybody tell me, how to copy many of files?
>
> Thanks a lot and have a good day
>
> Martin
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>





More information about the fpc-pascal mailing list