How to accept multiple lines input from User in C?
Hi
I want to accept multiple lines input with spaces from User and i have a working code like this.
but the problem is "sReq" is accepting the input but "sRes" is not accepting. If i change the second scanf to scanf("%s",sRes); it is accepting input but not input with spaces.
Why? What's the reason? How to solve this?
Thanks
---------- Post updated at 05:01 AM ---------- Previous update was at 03:47 AM ----------
I have a situation where I want the user to enter only numbers in response to a READ command. I have some validation to restrict the number to be between 1 and 12, but if the user type in some characters the script echoes some error message and goes to the next command. Below is a snippet of the... (1 Reply)
hi,
am a new learner to shell programming.
i have a script which will prompt for user to key in their name & display their name afterwards.
script
=====
echo "Pls enter your name:"
read name
echo "Your name is $name."
output
=====
Pls enter your name:
Bob
Your name is Bob.
what... (2 Replies)
Hi All,
I am trying to write a script in which I need to accept multiple value in the same variable.
The case Is that I have put a FOR loop and inside the FOR loop I am accepting a variable value. And I require all the values which gets inputted in the variable.
To be... (5 Replies)
Dear All,
The sqlplus 'Accept' command is not waiting for user input when I include the command within a shell script.
Note: The 'Accept' command is working fine if I execute it in a SQLPLUS Prompt.
Please fins the below sample script which i tried.
SCRIPT:
--------
#!... (4 Replies)
Hello,
I need to capture multiple values from user input and do not know how to do it. I'm writing a script to delete old files, but want to give the option to keep some by asking the user.
This is what my output looks like...
Old files to be deleted...
1 file1
2 file2
Then this bit of... (3 Replies)
I want a shell script that accepts user input simultaneously when performing other tasks. Example: A shell script should echo some messages on the console and when the user presses some keys it should respond to that action.
say, when user presses the key
A - more information should be printed... (2 Replies)
I am trying to create a script that will accept multi input from the user (really just me), then execute those command on a remote device.
My question is if the I enter "No" at the confirmation point "Are these statements correct y or n ?", what is the best way to go back and start over ? I... (3 Replies)
Hi All
I have a very tricky problem, not able to solve it. Hence asking this question.
I have a code portion like this -
int
parse_msg(in_buf,line1,line2,sccs_line)
char in_buf;
char line1;
char line2;
char sccs_line;
{
....
(void)fprintf(trace_fp,"parse_msg1 in_buf = %s \n",... (0 Replies)
GM,
I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed.
I am assuming that sed, awk or even perl could do what I need.
I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies
LEARN ABOUT OPENSOLARIS
mvscanw
curs_scanw(3CURSES) Curses Library Functions curs_scanw(3CURSES)NAME
curs_scanw, scanw, wscanw, mvscanw, mvwscanw, vwscanw - convert formatted input from a curses widow
SYNOPSIS
cc [ flag ... ] file ... -lcurses [ library ... ]
#include <curses.h>
int scanw(char *fmt, /* arg */ ...);
int wscanw(WINDOW *win, char *fmt, /* arg */ ...);
int mvscanw(int y, int x, char *fmt, /* arg */ ...);
int mvwscanw(WINDOW *win, int y, int x, char *fmt, /* arg */...);
int vwscanw(WINDOW *win, char *fmt, va_list varglist);
DESCRIPTION
The scanw(), wscanw(), and mvscanw() routines correspond to scanf() (see scanf(3C)). The effect of these routines is as though wgetstr()
were called on the window, and the resulting line used as input for the scan. Fields which do not map to a variable in the fmt field are
lost.
The vwscanw() routine is similar to vwprintw() in that it performs a wscanw() using a variable argument list. The third argument is a
va_list, a pointer to a list of arguments, as defined in <varargs.h>.
RETURN VALUES
vwscanw() returns ERR on failure and an integer equal to the number of fields scanned on success.
Applications may interrogate the return value from the scanw, wscanw(), mvscanw(), and mvwscanw() routines to determine the number of
fields which were mapped in the call.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO curs_getstr(3CURSES), curs_printw(3CURSES), curses(3CURSES), scanf(3C), attributes(5)NOTES
The header <curses.h> automatically includes the headers <stdio.h> and <unctrl.h>.
SunOS 5.11 31 Dec 1996 curs_scanw(3CURSES)