Sponsored Content
Top Forums Programming Changing stdin from file redirection to console input Post 7659 by rwb1959 on Friday 28th of September 2001 10:58:32 PM
Old 09-28-2001
I'm not exactly clear what
you are trying to do but
after your done reading the file,
try closing all fd's

// assuming you have no more that 10 files open
for(i = 0; i < 10; i++)
{
if(close(i) < 0)
break;
}

...then open a new file. The fd will be 0 (stdin).
 

10 More Discussions You Might Find Interesting

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

2. Cybersecurity

changing /cn@0:console file permissions

I'm doing a security sweep of a Sun Sol 5.8 system. The file: /dev/console, which links to /devices/pseudo/cn@0:console, has the following perms: crw--w--w- I would like to get rid of the world write permissions. I can change the file permissions, but as soon as log back in, they are changed... (4 Replies)
Discussion started by: ErnieG
4 Replies

3. UNIX for Dummies Questions & Answers

send output of a file as input for changing date

Hi, Please help me out on this one. I want to send the output of a file as input for changing the date using date command. Example, i have a file date.txt whose contents are 081014462009 I need to use the date in that file as input for date command. I tried cat date.txt | date ; but it... (2 Replies)
Discussion started by: foxtron
2 Replies

4. Shell Programming and Scripting

Create Multiple files by reading a input file and changing the contents

Being new to this area .I have been assigned a task which i am unable to do . Can any one please help me . Hi I have requirement where i have input file XYZ_111_999_YYYYMMDD_1.TXT and with header and series of Numbers and Footer. I want to create a mutiple output files with each file having a... (2 Replies)
Discussion started by: bhargavkr
2 Replies

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

6. UNIX for Dummies Questions & Answers

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... (4 Replies)
Discussion started by: cypleen
4 Replies

7. UNIX for Advanced & Expert Users

Console Input from a file

hi 2 all whatever in a file that line have to come in console screen .. when i execte that script ... >cat abc date ls >./abc >date ---->that line hav to come here > ls ----> that line hav to come here please anyone help me ! (4 Replies)
Discussion started by: ponmuthu
4 Replies

8. Shell Programming and Scripting

Suplying stdin input within script

Hi , I have script in that , i uninstall rpm using rpm -ef $rc1 now my query is rpm -ef is asking user input DO YOU Want To continue (YES/NO) for each uninstalltion. now i want to supply YES variable when it asks for above statement . so that i dont have to give user input from... (4 Replies)
Discussion started by: raghavendra.nsn
4 Replies

9. UNIX for Dummies Questions & Answers

Redirection of file input to command

Hello, I'm new to Unix (working with OS X 10.8.5) and therefore at the beginning of my adventure. If I ask something stupid, then this is not intentional, but simple nescience. :rolleyes: I have a problem with the redirection of text file content to echo. I was experimenting with redirection... (6 Replies)
Discussion started by: pseudo
6 Replies

10. UNIX for Dummies Questions & Answers

When do I use input redirection?

Can someone please explain when input redirection is necessary? For example, "cat filename" and "cat< filename" produce the same result. I was told that if I need to bunzip a file that I should type "bunzip2<filename.bz2." However, if I omit the "<" I still get the same result. Can someone... (4 Replies)
Discussion started by: PTcharger
4 Replies
eof(1T) 						       Tcl Built-In Commands							   eof(1T)

__________________________________________________________________________________________________________________________________________________

NAME
eof - Check for end of file condition on channel SYNOPSIS
eof channelId _________________________________________________________________ DESCRIPTION
Returns 1 if an end of file condition occurred during the most recent input operation on channelId (such as gets), 0 otherwise. ChannelId must be an identifier for an open channel such as a Tcl standard channel (stdin, stdout, or stderr), the return value from an invocation of open or socket, or the result of a channel creation command provided by a Tcl extension. EXAMPLES
Read and print out the contents of a file line-by-line: set f [open somefile.txt] while {1} { set line [gets $f] if {[eof $f]} { close $f break } puts "Read line: $line" } Read and print out the contents of a file by fixed-size records: set f [open somefile.dat] fconfigure $f -translation binary set recordSize 40 while {1} { set record [read $f $recordSize] if {[eof $f]} { close $f break } puts "Read record: $record" } SEE ALSO
file(1T), open(1T), close(1T), fblocked(1T), Tcl_StandardChannels(3TCL) KEYWORDS
channel, end of file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWTcl | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for Tcl is available on http://opensolaris.org. Tcl 7.5 eof(1T)
All times are GMT -4. The time now is 08:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy