Sponsored Content
Top Forums Programming Read in numbers from console won't stop at newline. Post 303007995 by Corona688 on Friday 24th of November 2017 05:54:16 PM
Old 11-24-2017
The >> operator does not care at all about lines. If you want lines, you'll have to separate it some other way, which is exactly what the stackoverflow code does.

It reads entire lines with getline, then crams the entire line into a stringstream object. A stringstream, unlike standard input, will just hit EOF when it runs out of data instead of waiting for more.
These 2 Users Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script does not stop when doing a read

Hi Folks, I have been trying to create a script wherein after it reads a certain number of data, it will pause and ask the user if he wants to continue or not. However, it seems that when it is supposed to read the user's answer, the script will go into a loop. What is wrong with my script here?... (7 Replies)
Discussion started by: rooseter
7 Replies

2. Shell Programming and Scripting

read from console in ksh

I am stuck with a problem while reading data from a file.. while do read line #do some operations and if some condition is satisfied, ask the user to enter his choice. # using the choice continue operations. done < fileBeingRead.txt The... (4 Replies)
Discussion started by: ajaykumarns
4 Replies

3. Solaris

Red stop signs in Solaris Management Console 2.1

I've installed Solaris 10 (x86 8/07) on a Dell PowerEdge 2950. When I bring up the Solaris Management Console I get red stop sign looking icons on all areas (System Status, System Configuration, Services, Storage, and Devices and hardware) under This computer. Originally nothing was showing up... (1 Reply)
Discussion started by: kayroreality
1 Replies

4. Shell Programming and Scripting

read numbers from file and output which numbers belongs to which range

Howdy experts, We have some ranges of number which belongs to particual group as below. GroupNo StartRange EndRange Group0125 935300 935399 Group2006 935400 935476 937430 937459 Group0324 935477 935549 ... (6 Replies)
Discussion started by: thepurple
6 Replies

5. UNIX for Dummies Questions & Answers

how to stop the message on the console

Hi, Sun Solaris. I am working on the console, I have pulled the network cable out. I am in the process of changing the IP address and few others thing. But this message comes every few seconds. SUNW,hme0: Link Down - cable problem? SUNW,hme0: Link Down - cable problem? It's very... (2 Replies)
Discussion started by: samnyc
2 Replies

6. Shell Programming and Scripting

Null Handling in Until loop. . .loop won't stop

Hi Im running this script, which is supposed to find the max value build some tables and then stop running once all the tables are built. Thing is , it keeps assigning a null value to $h and then $g is null so it keep building tables i.e. testupdateNUL. How can I stop this? Here is what I have: ... (4 Replies)
Discussion started by: brandono66
4 Replies

7. Shell Programming and Scripting

Read Embedded Newline characters with read (builtin) in KSH93

Hi Guys, Happy New Year to you all! I have a requirement to read an embedded new-line using KSH's read builtin. Here is what I am trying to do: run_sql "select guestid, address, email from guest" | while read id addr email do ## Biz logic goes here done I can take care of any... (6 Replies)
Discussion started by: a_programmer
6 Replies

8. Shell Programming and Scripting

Loop to read parameters and stop

Hey guys, How do I make a loop that reads all the parameters en then stop when there are no parameters anymore ? Something that gives an output like this: ./Script.sh parameter1 parameter2 parameter3 parameter = parameter1 parameter = parameter2 parameter = parameter3 Thanks a lot,... (5 Replies)
Discussion started by: Miki1579
5 Replies

9. HP-UX

CDE Login on console won't use keyboard

Hi all, I'm installing a HP r2660 machine with HP-UX 11.23 (this version fixed by customer's product) and I've troubles using the VGA console as workstation display. At first it worked just as TEXT console, then I fixed /etc/dt/config/Xservers and now I've the CDE prompt for login. ... (5 Replies)
Discussion started by: larry100
5 Replies

10. Shell Programming and Scripting

While read won't run keyboard function

I am using while read do/ done to retrieve menu item. Works as advertised, no problem. I am using this hack function "pause" to stop script execution and wait for keyboard "enter" key to continue. Sort of break point function. Also works fine with one exception - it does not work when used... (4 Replies)
Discussion started by: annacreek
4 Replies
recordio(1)                                                   General Commands Manual                                                  recordio(1)

NAME
recordio - record the input and output of a program SYNTAX
recordio program [ arg ... ] DESCRIPTION
recordio runs program with the given arguments. It prints lines to stderr showing the input and output of program. At the beginning of each line on stderr, recordio inserts the program process ID, along with < for input or > for output. At the end of each line it inserts a space, a plus sign, or [EOF]; a space indicates that there was a newline in the input or output, and [EOF] indicates the end of input or output. recordio prints every packet of input and output immediately. It does not attempt to combine packets into coherent stderr lines. For example, recordio sh -c 'cat /dev/fd/8 2>&1' > /dev/null could produce 5135 > cat: /dev/fd/8: Bad file descriptor 5135 > [EOF] or 5135 > cat: + 5135 > /dev/fd/8+ 5135 > : + 5135 > Bad file descriptor 5135 > [EOF] recordio uses several lines for long packets to guarantee that each line is printed atomically to stderr. recordio runs as a child of program. It exits when it sees the end of program's output. SEE ALSO
tcpserver(1) recordio(1)
All times are GMT -4. The time now is 06:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy