Type of file mode variable

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Type of file mode variable

Jürgen Hestermann
In the file \lazarus\fpc\2.4.3\source\rtl\inc\systemh.inc I found the
following definitions:

{ file input modes }
  fmClosed = $D7B0;
  fmInput  = $D7B1;
  fmOutput = $D7B2;
  fmInOut  = $D7B3;
  fmAppend = $D7B4;
  Filemode : byte = 2;

If I assign "Filemode := fmInOut" I get a constant range check error (at
compilation time) which is clear because all constants are larger than
byte.
Is this a bug?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Type of file mode variable

Jonas Maebe-2

On 17 Mar 2011, at 19:07, Jürgen Hestermann wrote:

> If I assign "Filemode := fmInOut" I get a constant range check error (at compilation time) which is clear because all constants are larger than byte.
> Is this a bug?

No. See http://www.freepascal.org/faq.var#filemode for more info.


Jonas_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Type of file mode variable

Jürgen Hestermann


Jonas Maebe schrieb:
> On 17 Mar 2011, at 19:07, Jürgen Hestermann wrote:
>  
>> If I assign "Filemode := fmInOut" I get a constant range check error (at compilation time) which is clear because all constants are larger than byte.
>> Is this a bug?
>>    
> No. See http://www.freepascal.org/faq.var#filemode for more info.
>
>
>  
I didn't find "fminout" and the other constants mentioned at this link.
Are they not for assigning to filemode?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Type of file mode variable

Jonas Maebe-2

On 17 Mar 2011, at 19:24, Jürgen Hestermann wrote:

> Jonas Maebe schrieb:
>> On 17 Mar 2011, at 19:07, Jürgen Hestermann wrote:
>>  
>>> If I assign "Filemode := fmInOut" I get a constant range check error (at compilation time) which is clear because all constants are larger than byte.
>>> Is this a bug?
>>>    
>> No. See http://www.freepascal.org/faq.var#filemode for more info.
>>
>
> I didn't find "fminout" and the other constants mentioned at this link.

It describes the values you can assign to filemode and their effect.

> Are they not for assigning to filemode?

No. They're mainly for internal use in the system unit. I guess the only reason they are public is that they can also be useful when you implement your own text file driver (which you're unlikely to want to do).


Jonas_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Type of file mode variable

Jürgen Hestermann
Jonas Maebe schrieb:
 >> I didn't find "fminout" and the other constants mentioned at this link.
 > It describes the values you can assign to filemode and their effect.

Does that mean, that only 3 values for filemode (0, 1 and 2) exist?
Then it is quite confusing to group the filemode declaration and the
other (multi byte) fmxxxx constants together if they are completely
unrelated.

In the link it also says:
"For more information, consult the Free Pascal reference manual"
I found filemode mentioned in the RTL manual where in section 10.5 it says:
"For their defnitions consult the following table:"
But there is no following table. A bug in the manual?

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Type of file mode variable

Michael Van Canneyt


On Fri, 18 Mar 2011, Jürgen Hestermann wrote:

> Jonas Maebe schrieb:
>>> I didn't find "fminout" and the other constants mentioned at this link.
>> It describes the values you can assign to filemode and their effect.
>
> Does that mean, that only 3 values for filemode (0, 1 and 2) exist?
> Then it is quite confusing to group the filemode declaration and the
> other (multi byte) fmxxxx constants together if they are completely
> unrelated.
>
> In the link it also says:
> "For more information, consult the Free Pascal reference manual"
> I found filemode mentioned in the RTL manual where in section 10.5 it says:
> "For their defnitions consult the following table:"
> But there is no following table. A bug in the manual?
Yes, can you please file a bug report ?

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal