I would like to use mknod in my code to create a file, but man says, that 
The only portable use of mknod() is to create a FIFO-special file. If mode is not S_IFIFO or dev is not 0, the behavior of mknod() is unspecified.
Does that mean, that mknod is not really portable and I should use some other way to create a function? How about calling open and the instantly close? Which way is safer?
                        
mknodis not for creating files. It's for creating device nodes. A portable application will never need to create device nodes because whether they exist, what they are, and how they're implemented/numbered is an implementation detail.mknodhistorically allowed you to create fifos too (and perhaps ordinary files?), but there are instead standard interfaces for this:mkfifofor fifos, andcreat(oropenwithO_CREAT) for ordinary files.