03.04.2015, 15:10
Flags de acordo com a wiki:
Minha traduзгo e conhecimento p.p:
Agora nгo entendi ao certo sua duvida se vocк quer ler um arquivo seria desta forma:
Quote:
io_write Writes in a file, clears all earlier written text io_read Reads the file, the file must exist, otherwise a crash will occur io_append Appending to a file, writing only io_readwrite Reads the file or makes a new one |
Quote:
io_write Escreve em um arquivo, limpa tudo que tinha antes io_read Ler um arquivo io_append Escreve em um arquivo, nгo limpa tudo que tinha antes io_readwrite Ler ou escrever |
PHP код:
// Open "file.txt" in "read only" mode
new File:handle = fopen("file.txt", io_read),
// Initialize "buf"
buf[128];
// Check, if the file is opened
if(handle)
{
// Success
// Read the whole file
while(fread(handle, buf)) print(buf);
// Close the file
fclose(handle);
}
else
{
// Error
print("The file \"file.txt\" does not exists, or can't be opened.");
}