Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Simple log save
- #define TEST_FILE "testfile.txt" // Our definiton for a file
- new File:myfile; // Our file variable
- if(fexist(TEST_FILE)) myfile = fopen(TEST_FILE, io_append); // Does add the text after the original saved text inside the file (If the file exists of course)
- else myfile = fopen(TEST_FILE, io_write); // Otherwise we just create the file and add the new text in.
- if(myfile) // If the file does NOT return File:0, so the file has been created/opened properly.
- {
- fwrite(myfile, "This is a text\r\n"); // We write now something inside the file
- fclose(myfile); // Closes our file
- }
- else printf("Couldn't open file '%s'.", TEST_FILE); // There are some reasons why a file cannot be created/opened.
Advertisement
Add Comment
Please, Sign In to add comment