// Open "file.txt" in "read and write" mode
new File:handle = fopen("file.txt"),
// Initialize "buf"
buf[128];
// Check, if file is open
if(handle)
{
// Success
// Read the whole file
while(fread(handle, buf)) print(buf);
// Set the file pointer to the first byte
fseek(handle, _, seek_begin);
// Write "I just wrote here!" into this file
fwrite(handle, "I just wrote here!");
// Close the file
fclose(handle);
}
else
{
// Error
print("The file \"file.txt\" does not exists, or can't be opened.");
}
error 017: undefined symbol "seek_begin" |
Originally Posted by Wiki Samp
Whences
seek_start Set the file position relative to the start of the file (the position parameter must be positive). seek_current Set the file position relative to the current file position: the position parameter is added to the current position. seek_end Set the file position relative to the end of the file (parameter position must be zero or negative). |