Re: Redirection issue
- From: "souissipro" <souissipro@xxxxxxxx>
- Date: 1 Sep 2006 06:06:35 -0700
Ed Prochak wrote:
souissipro wrote:
Ed Prochak wrote:[snip]
[snip]
My question is did you follow ANY of the suggestions I gave you? Your
error is very simple. I did look at your code and found the problem
right away. I really am trying to help you learn. This problem is
independent of the programming language. So please, review your own
code. before you scroll down to what I see as the root problem.
You never called the new function!
BTW, long term your approach is going about it the hard way, but you'll
learn more this way.
Ed
Hi Ed,
Thank you anyway for your comments. I appreciate them very much.
I decommented the code in the new function redir_cmd, changed the types
of fd1 and fd2 to char and the redirection works fine now. However, the
simple command and the simple input file are now not working.
Please any precise idea because I have to finish this shell for
tomorrow.
Thanks,
souissipro
based on your reply, I take it that
you did NOT follow any of my suggestions. (I could be wrong. 8^)
your source listing from the first post is not the version of code you
are currrently discussing since my comment was about the main() routine
and nothing was commented out in that version. I haven't seen you post
another version.
Finally, NEVER expect responses in a newsgroup in less than 24 hours.
Some people will not even have seen your request before a full day has
past. Just remember, newsgroups are not like AOL Chat rooms.
Good luck, you will need it.
Ed
ED,
OK!
to reply your answer. The new function is called in the main here:
if (argc == 3) {
f = fopen(argv[1], "r");
if (f == NULL) {
fprintf(stderr, "impossible d'ouvrir le fichier en lecture\n");
exit(EXIT_FAILURE);
}
/* fgets fait une lecture ligne par ligne, et stocke */
/* la ligne lue (y compris le \n) dans buf */
/* il faut que la ligne fasse moins de 255 caracteres */
/* sinon seuls les 255 premiers caracteres sont lus */
while (fgets(buf, 255, f) != NULL) {
// call of the new function via parse_line function
parse_line(buf,argv[1],argv[2]);
printf("%s",buf);
}
isn't right?
.
- Prev by Date: Re: how to do it!!
- Next by Date: Re: Abnormal program termination
- Previous by thread: how to do it!!
- Next by thread: Re: Redirection issue
- Index(es):
Relevant Pages
|