pipes importance

Most of us have used the pipes(in bash, not C) at some point. Have you ever thought of what it would be without the pipes i.e could you think of making a c script for this function. “Ah, I think” yeah that’s it, it’s like parallelism – scanning the stdout while the stdout is being written. OR – yeah, we have to backup the fore-coming stdout…

I got a problem like reading the system() output like $PWD from c program, I usually do it in an old fashioned way


char pwd[100];

FILE *fp;

system("pwd > /tmp/a13d84bv8w84bhjs83hj8fd8.txt");

fp = fopen("/tmp/a13d84bv8w84bhjs83hj8fd8.txt", "w");

fscanf(fp, "%s", pwd);

I heard there’s a secure way of using this method like no one has the ability to read the file, using pipes. SO i’m on it, for now

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s