Extended KotD #9: _WRITEFILE - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Official Links (https://qb64phoenix.com/forum/forumdisplay.php?fid=16) +--- Forum: Learning Resources and Archives (https://qb64phoenix.com/forum/forumdisplay.php?fid=13) +---- Forum: Keyword of the Day! (https://qb64phoenix.com/forum/forumdisplay.php?fid=49) +---- Thread: Extended KotD #9: _WRITEFILE (/showthread.php?tid=2713) |
Extended KotD #9: _WRITEFILE - SMcNeill - 05-20-2024 The last of the new keywords and enhancements for v3.12 is _WriteFile. Like _ReadFile$, it's a simple shortcut which can help reduce multiple commands into one simple process. In the past, one would have to do the following to write a binary file to the drive: Code: (Select All) F = FreeFile Now, however, since v3.12, one can replace all the above code with the following: Code: (Select All) _WriteFile "temp.txt", your_string$ No need to get a file handle. No need to open the file FOR OUTPUT to make certain it's blank and you're not corrupting a previous file with the same name. No need to close that handle and then reopen another FOR BINARY to write the file...only to have to close it once again. Just a simple _WriteFile file$, string_to_write$ That's all there is for this little shortcut command! |