[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: read-write to stdin-stdout or to a file?



Hola!

--- Pedro Zorzenon Neto <pzn@terra.com.br> wrote:

>    This program needs to read data from a file and
> also write to other file.
> 
>    I could use some options like this:
> 
>       $ avrprog -i input.data -o output.data
> 
>    But I chose to use stdin/stdout instead.
> 
>       $ avrprog < input.data > output.data
> 
>    Than I don't need to check if the user has
> permission to read/write that file, don't need to
> check for symlink... because the shell will do this
> for me.
>    
>    Is this right? Did I make the right option when I
> decided to use stdin/stdout.

I think, the better way is to use freopen() function
to reassign stdin, stdout and stderr.
This is more secure and shell-independant desision...


=====
Regards, Vladislav. ---> http://cybervlad.port5.com

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



Reply to: