IMind soft

Author's software

Development

Design

Designing

Being tested

Writing data to the file

In short: writefile(handle, data, size) simply writes data to a file. That's it.'s it.

Now — without tediousness and to the point. You have an open file, you need to put something in it. You take a handle (the same handle), put data in it (string, bytes— whatever), specify exactly how many bytes you want to write, and writefile does its job.

Handle is, in fact, a shortcut to an open file. Such a pass: "I've checked everything here, this file is open, you can write. "

What does writefile do in practice:

First he checks: is the file open at all? (If not, he'll swear)

Then he pulls the OS: they say, hold the handle, here's the data for you, write

Receives a response from the system: did it work or not

If it didn't work out, it reports an error (yes, the disk may be overflowing, or there are no recording rights — classic)

And — an important point — closes the file so as not to hang in memory in vain

Who will say: "Well, why do I need this function?" — I answer. If you want to save the log, upload, report, draft of the novel, go here. If you want to control what is being written and where, manage the process, and not rely on chance, especially here. It's not just a "what if it comes in handy", it's a real tool for working with files normally.



Help on built-in functions
The rules of programming scripts
Programm options
Color constants

Top.Mail.Ru