Operation of file handling functions

Asked

Viewed 95 times

6

I know the syntax, the logic of the function. I would like to know how it works in the background. Example, I gave the function fopen(), fclose(), fwrite(), What am I actually doing? Would it be possible to write these functions on hand? How? If it is not possible, what happens then for me to be able to open files, close, etc.. ?

Thank you!

  • These functions are basically Wrappers for the equivalents in C.

  • That’s a nice question, I already have some experience in PHP, but I really can’t say if it’s possible. But I don’t think it’s possible. I think this is a task for the PHP interpreter, where you should have some library in C or something like that. Waiting for answers...

1 answer

3


PHP is written on top of C, so what these functions do is simply call for fopen(), fclose(), and other functions of stdio.h of C.

So you can’t directly access a file in the file system without using these functions that PHP makes available.

If you want to know more how C reads a file read that answer in the OS.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.