c - Is using streams over pipes under Linux worthwhile? -


when using pipes communicate between processes under linux, there benefit creating streams pipes using fdopen , using fread/fwrite on streams instead of read/write?

standard input/output (stdio)

fdopen part of stdio library. stdio manual, this:

the standard i/o library provides simple , efficient buffered stream i/o interface. input , output mapped logical data streams , physical i/o characteristics concealed. functions , macros listed below; more information available individual man pages.

and then:

the stdio library part of library libc , routines automatically loaded needed compilers cc(1) , pc(1). synopsis sections of following manual pages indicate include files used, compiler declaration function looks , external variables of interest.

being part of libc, means programs written using these functions compile in standard-conforming compilers. if write program using open/write (which posix), program run on posix systems.

so reason (a) it's worth because of portability , (b) it's not worth if you're using in linux, because using open/write remove whole lot of abstraction (from stdio) - keep in mind under gnu glibc open/write wrappers around syscalls, you're not calling directly, small amount of abstraction present.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -