Sponsored Content
Full Discussion: stdin redirection
Top Forums UNIX for Dummies Questions & Answers stdin redirection Post 302400605 by cypleen on Wednesday 3rd of March 2010 04:44:25 PM
Old 03-03-2010
stdin redirection

Hello,
my C application under unix runs in redirecting stdin to a file.
Example:$appli1 <file1. This application waits often on a scanf().
But I would temporarely reassign stdin at the keyboard for waiting a user's answer. So I thought to add system("appli2"); in the code of appli1. In its main(), appli2 executes only scanf(), then exit(). But when appli2 exits then appli1 continues, stdin is still assigned to the keyboard instead of file1. But I would like that stdin stays assigned to file1.
Thank you for your answer.
 

10 More Discussions You Might Find Interesting

1. Programming

Changing stdin from file redirection to console input

Hi I am doing file redirection at console for use by my binary. %console%> bin &lt inputfile After reading in the entire file, I want my program to continue taking input from the console. So essentially I want to redirect stdin back to console. But I cant figure out how to do it. I am... (4 Replies)
Discussion started by: nauman
4 Replies

2. Programming

stdin

hi, how does a program know whether some data are available from stdin? I would like to make a program which could read its data from stdin and _if_there_is_nothing_at_stdin_ from a file which name is given as an argument. If there is nothing in stdin and no filename is given as argument,... (2 Replies)
Discussion started by: marquis
2 Replies

3. HP-UX

stdin device on HP

How can I access the standard-in device in HP-UX? I am trying to automate sftp on an HP-UX system. On solaris I can just do: sftp -b /dev/fd/0 remotehost <<EOF cd pub ascii get filename.txt bye EOF (2 Replies)
Discussion started by: dangral
2 Replies

4. Shell Programming and Scripting

redirection stdin

hello all, I need to create a password change utility for a database. I need to gather at the command line the username, password and database sid. I have the program currently doing this. What I would like to do is not have the new password appear on the screen when I do my read command.... (2 Replies)
Discussion started by: whited05
2 Replies

5. Shell Programming and Scripting

redirect STDIN

can you redirect STDIN with command arguments? I have tried this approach: # ./script -option <argument1> <argument2> 0<$2 # $2: ambiguous redirect Is this possible? (4 Replies)
Discussion started by: prkfriryce
4 Replies

6. 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

7. 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

8. UNIX for Dummies Questions & Answers

fork and stdin

When a process fork(), the child share the same file descriptors as his father. Thus, they share the same stdin. Quick and dirty exemple below (sorry for the ugly gets() call) : #include <stdio.h> #include <unistd.h> int main() { char buf; if (fork()) { /*parent */ ... (1 Reply)
Discussion started by: milouz
1 Replies

9. Shell Programming and Scripting

Redirecting stdin from fd 3-9?

Hi I'm trying to do something on the bash command line that I will later put into a bash shell script. I'm trying to take a program that reads stdin (using getline) and be able to keep it running in the background and fire "commands" to it. So what I thought I should do was to try taking... (3 Replies)
Discussion started by: niceguyeddie
3 Replies

10. UNIX for Dummies Questions & Answers

redirection stdin

Bonjour, Mon application en C sous linux tourne en redirigeant stdin vers un fichier. Exemple; $appli1 <file1. PB: Je voudrais temporairement redonner la main au user sur le clavier. Alors je pensais ajouter system("appli2"); dans appli1. Dans son main() , appli2() fait seulement un... (1 Reply)
Discussion started by: cypleen
1 Replies
esdcat(1)							   User Commands							 esdcat(1)

NAME
esdcat - play a sound file SYNOPSIS
esdcat [-s hostname:port] [-b] [-h] [-m] [-n filename] [-r freq] [filename] DESCRIPTION
The esdcat application pipes data from the filename specified (or stdin if not specified) to the sound device, using the Enlightened Sound Daemon (esd). OPTIONS
The following options are supported: -s hostname:port Contact the esd server on hostname at port. -b Specify that the output should be in 8-bit format. By default, the output is in 16-bit format. -h Display help text, and exit. -m Specify that the output should be in mono format. By default, the output is in stereo format. -n filename Specify the filename of the input file. If the filename is specified both as an operand and with the -n option, then the value specified with the -n option is ignored. If no filename is specified with the command, then stdin is used. -r freq Specify that the output rate should be set to freq. By default, the output rate is set to 44.1 kHz. OPERANDS
The following operands are supported: filename Specify the filename of the input file. If no filename is specified with the command, then stdin is used. EXAMPLES
Example 1: Playing a sound file "beep" from stdin example% esdcat < beep EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/esdcat Executable for Enlightened Sound Daemon sound piper ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-audio | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
esdplay(1), esdrec(1), esdsample(1), esdmon(1), esdctl(1), esd-config(1), libesd(3), attributes(5) NOTES
Written by Brian Cameron, Sun Microsystems Inc., 2003, 2006. SunOS 5.11 7 Jan 2003 esdcat(1)
All times are GMT -4. The time now is 09:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy