#C language help actually

43 messages · Page 1 of 1 (latest)

rugged dawn
#

is there anyone that can help me with understanding popen and pclose in C I am having a hard time understanding them from the man page
:(

lyric pewter
#

obviously if you to write to that pipe instead you'd use "w" as the second argument

rugged dawn
#

also should the path to a file be any file or a fifo?

lyric pewter
#

you don't to explicitly call pipe, and fork

#

that's the advantage

#

the path is just an example because i used catas an example

#

you can use any other command

rugged dawn
#

ohh

#

lets say I want to pass a message from parent to a child process can u give me a psuedo code or code for it

lyric pewter
#

is the child process an external command?

sonic flax
#

what is people using pipe for? shared memory?

rugged dawn
lyric pewter
rugged dawn
sonic flax
#

client-client communication?

#

like a c++ project to another C++ project

lyric pewter
#

i used cat, but it could just be ls for example

rugged dawn
#

yeah read-end got it

#

I see

lyric pewter
rugged dawn
#

|

lyric pewter
#

yeah

#

processes can communicate via pipes but they must be somehow "related" (either "siblings" or "father-son" relationship)

lyric pewter
#

also communication is unidirectional

rugged dawn
lyric pewter
sonic flax
lyric pewter
#

it consists of two processes

#

ls lists the contents of a directory

#

grep is essentially a filter command

#

the | is the pipe operator interpreted by your shell

#

so, the output of ls, which would normally be printed to the terminal is fed into grep's stdin

#

and grep will only print entries which contain the string '.jpg'

lyric pewter
#

i dont remember if this is how you use fwrite