poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IOS: modes for opening files


From: Bruno Haible
Subject: Re: IOS: modes for opening files
Date: Sat, 06 Mar 2021 15:44:38 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-203-generic; KDE/5.18.0; x86_64; ; )

Hi José,

> The `fopen' call supports three general modes for opening files

Since you are looking for a bitmask, I like to look at the POSIX 'open' call
<https://man7.org/linux/man-pages/man2/open.2.html>.

> We could follow the same model in the Poke `open', and provide:
> 
>   IOS_F_READ
>   IOS_F_WRITE
>   IOS_F_CREATE
>   IOS_F_TRUNCATE
>   IOS_F_APPEND  (implies IOS_F_CREATE)

Yes, this would correspond to

    IOS_F_READ              O_RDONLY
    IOS_F_WRITE             O_WRONLY
    IOS_F_CREATE            O_CREAT
    IOS_F_TRUNCATE          O_TRUNC
    IOS_F_APPEND            O_APPEND

> for other kind of IO devices other combinations
> of the flags may be useful, or not the six of them.

Yes. The POSIX 'open' interface is more extensible than the 'fopen' interface.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]