Class Stdio.File
- Description
This is the basic I/O object, it provides socket and pipe communication as well as file access. It does not buffer reads and writes or provide line-by-line reading, that is done with Stdio.FILE object.
- Note
The file or stream will normally be closed when this object is destructed (unless there are more objects that refer to the same file through use of assign or dup). Objects do not contain cyclic references in themselves, so they will be destructed timely when they run out of references.
- See also
- Inherit
Fd_ref
optional
inherit _Stdio.Fd_ref : Fd_ref
- Method
create
Stdio.File Stdio.File()
Stdio.File Stdio.File(
string
filename
)
Stdio.File Stdio.File(
string
filename
,string
mode
)
Stdio.File Stdio.File(
string
filename
,string
mode
,int
mask
)
Stdio.File Stdio.File(
string
descriptorname
)
Stdio.File Stdio.File(
int
fd
)
Stdio.File Stdio.File(
int
fd
,string
mode
)- Description
There are four basic ways to create a Stdio.File object. The first is calling it without any arguments, in which case the you'd have to call open(), connect() or some other method which connects the File object with a stream.
The second way is calling it with a filename and open mode. This is the same thing as cloning and then calling open(), except shorter and faster.
The third way is to call it with descriptorname of
"stdin"
,"stdout"
or"stderr"
. This will open the specified standard stream.For the advanced users, you can use the file descriptors of the systems (note: emulated by pike on some systems - like NT). This is only useful for streaming purposes on unix systems. This is not recommended at all if you don't know what you're into. Default mode for this is
"rw"
.- Note
Open mode will be filtered through the system UMASK. You might need to use
chmod()
later.- See also