Sponsored Content
Top Forums Programming Help:error in reading from stdin Post 302090122 by Corona688 on Friday 22nd of September 2006 01:07:09 PM
Old 09-22-2006
A few improvements and your code will be pretty good.

The switch/case statement is useless, just put the code inside the if/then/else.

case 2 will NOT print to a file.

That 'wait' is going to crash if it ever gets run since wait demands a pointer. But more likely it'll just hang forever.

You have done absolutely no error checking anywhere at all ever here, so it could be failing anywhere without you ever knowing. Why not have redirect() return a value? After all, a user might ask for something impossible.

If you run this program from a shell, chances are your program will never see the >> and < stuff since the shell handles that for you. You'll need to make them strings, like '<<', to prevent the shell doing that.

You haven't told us what the error is, though. What is it?

Last edited by Corona688; 09-22-2006 at 02:16 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

error reading from tape

Hi all, I am attempting to read tar images from a DLT tape, and have recieved an error, which i don't know: tar: blocksize = 8 tar: directory checksum error I have been able to read from other tapes, using the same command (tar -tvf /devicename) but this time i have an... (3 Replies)
Discussion started by: colesy
3 Replies

2. UNIX for Dummies Questions & Answers

reading from tape error

I have been attempting to read a DLT tape, but encountered problems. I have applied patches from SUN that 'resolve' known problems with tape reading etc...but still the error! Techsupport reckon that the data/tape is corrupt. I would like to think they aren't. Are there any issues with... (10 Replies)
Discussion started by: colesy
10 Replies

3. Shell Programming and Scripting

Reading an Error message

I have a script that reads a file then moves all the files that are listed within that file. So read file A then copy all files that are listed within. I have the script append a log everytime a file is moved. My issue is that it's appending the log even though the file was not found. ... (3 Replies)
Discussion started by: whegra
3 Replies

4. Solaris

error reading sections error at install

Hi, I'm trying to install Solaris 10 on my Ultra 10 but it won't boot. I tried an original cd and a downloaded one. I got the following error: "error reading sectors" (yes, i checked the md5 sums) For the complete error see the following shot: ... (2 Replies)
Discussion started by: doelman
2 Replies

5. Programming

How to write to stdin of another program (program A -> [stdin]program B)

Hi, Program A: uses pipe() I am able to read the stdout of PROGAM B (stdout got through system() command) into PROGRAM A using: * child -> dup2(fd, STDOUT_FILENO); -> execl("/path/PROGRAM B", "PROGRAM B", NULL); * parent -> char line; -> read(fd, line, 100); Question: ---------... (1 Reply)
Discussion started by: vvaidyan
1 Replies

6. UNIX for Dummies Questions & Answers

How to write to stdin of another program (program A -> [stdin]program B)

Hi, Program A: uses pipe() I am able to read the stdout of PROGAM B (stdout got through system() command) into PROGRAM A using: * child -> dup2(fd, STDOUT_FILENO); -> execl("/path/PROGRAM B", "PROGRAM B", NULL); * parent -> char line; -> read(fd, line, 100); Question: ---------... (3 Replies)
Discussion started by: vvaidyan
3 Replies

7. Shell Programming and Scripting

reading from stdin in a shell script

Hello, I've managed to get my .procmailrc file to work. At least it triggers a script which creates a file. But the file is empty. How do I get at the data that's been piped? I've done much creative googling to no avail. I belive it should be in stdin, but I can't figure out how to access... (4 Replies)
Discussion started by: mmesford
4 Replies

8. UNIX for Advanced & Expert Users

ssh error: Error reading response length from authentication socket

Hi - I am getting the error `Error reading response length from authentication socket' when I ssh from my cluster to another cluster, and then back to my cluster. It doesn't seem to affect anything, but it's just annoying that it always pops up and tends to confuse new users of the cluster. I... (1 Reply)
Discussion started by: cpp6f
1 Replies

9. SCO

Error: msgcnt 1 vxfs: mesg 016: vx_ilisterr - / file system error reading

Hello... i got an error in my SCO OpenServer 6. the error is: msgcnt 1 vxfs: mesg 016: vx_ilisterr - / file system error reading inode 373 Can anyone help me? (1 Reply)
Discussion started by: AndryMB
1 Replies

10. Shell Programming and Scripting

script hangs when reading from stdin

script: while read inputline; do if ; then if ; then break fi fi done Looks like the script hangs when stdin is empty or contains space. Any ideas on how to circumvent this? is it possible to use getline to process stdin content? (4 Replies)
Discussion started by: ux4me
4 Replies
All times are GMT -4. The time now is 02:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy