06-30-2011
Thanku for pointing out the part causing the problem with the input count...but can u suggest a way to overcome the problem..i couldn't get through it..n a little more on this behaviour of "scanf()" will also be helpful..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
All
I want to reverse and trim a string using UNIX shell scripts.Iam using Bourne shells. Can you help me? Thanx in advance
Regards
Deepak (5 Replies)
Discussion started by: DeepakXavier
5 Replies
2. Shell Programming and Scripting
If I have string { I_love_shell_scripts}
anyone knows how to have output {stpircs_llehs_evol_I}
by using shell and perl ?I know in perl, there is reverse() funcation, but
can it be done by not using reverse()? (3 Replies)
Discussion started by: ccp
3 Replies
3. Shell Programming and Scripting
Hello,
I think its a sinple query but somehow i m stucked up here...
I am trying to enter n number of inputs from the user and write them in
an input file ie row wise...
I tried standard commands like
$echo "enter the inputs for the file"
$read var1 var2 var3 var4
test1 test2... (14 Replies)
Discussion started by: er_aparna
14 Replies
4. UNIX for Dummies Questions & Answers
Hello Everybody,
Please help.
I was trying to automate the use of a third-party given shell script. The script is written to be used at run-time to collect a few variables to be provided by the user through key board, in the fashion as below:
./runcommand
please provide a file name to... (6 Replies)
Discussion started by: Dingrong
6 Replies
5. Shell Programming and Scripting
Hi Everyone....I am new to Unix and BASH programming...I just want to read a string and reverse it and display.....can anyone help me out???? (8 Replies)
Discussion started by: nikhilneela
8 Replies
6. Shell Programming and Scripting
ssh servername.com "echo /$APP=$BUSIN >> $URI; echo /$APP/*=$BUSIN >> $URI"
Ok for example here i ssh into a example servername.com, and I think what it does some line gets put into the urifile , my question is, how would i go about removing that in a script.
in summary, the above code is... (3 Replies)
Discussion started by: new2learn09
3 Replies
7. UNIX for Advanced & Expert Users
Hi All,
In my application, I'm getting an error as type mismatch
Let me now explain the scenario,
I ran a shell script which calls some other scripts. All these scripts uses the environment variables.
Take for example, this script uses a variable 'PathDir'. I initiallized the value to... (2 Replies)
Discussion started by: iamgeethuj
2 Replies
8. UNIX for Dummies Questions & Answers
Hello all,
Wondering if anyone can help me out.
Trying to cut the names out of the /etc/passwd file so that they can be displayed first then last name. I cut them out and put them into variables but cant get them to display side by side after cutting. Anyone able to help a newbie? (1 Reply)
Discussion started by: losingit
1 Replies
9. Shell Programming and Scripting
Hi..!
I'm stuck with my automation of starting a process and keeping it running even after the current ssh session has exited..
So i'm trying to use command 'screen'. which is doing exactly what i wanted, But the problem is automation of the same.
i will have to press Ctrl+a and Ctrl+d for... (2 Replies)
Discussion started by: chandana hs
2 Replies
10. UNIX for Dummies Questions & Answers
I have a unix command that prompts for 'y'. How do I run this from my shell script? (4 Replies)
Discussion started by: Sree10
4 Replies
scanf(3int) scanf(3int)
Name
scanf, fscanf, sscanf - convert formatted input
Syntax
#include <stdio.h>
int scanf( format [, pointer ] ... )
char *format;
int fscanf( stream, format [, pointer ] ... )
FILE *stream;
char *format;
int sscanf( s, format [, pointer ] ... )
char *s, *format;
Description
The international functions and are similar to the standard I/O functions. The difference is that the international functions allow you to
use the %digit$ conversion character in place of the I% character you use in the standard I/O functions. The digit is a decimal digit n
from 1 to 9. The international functions apply conversions to the n th argument in the argument list, rather than to the next unused argu-
ment.
You can use % conversion character in the international functions. However, you cannot mix the % conversion character with the %digit$
conversion character in a single call.
In all cases, uses the radix character and collating sequence that is defined by the last successful call to category or If the radix or
collating sequence is undefined, the function uses the C locale definitions.
International Environment
LC_COLLATE Contains the user requirements for language, territory, and codeset for the character collation format. affects the behav-
ior of regular expressions and the string collation functions in If is not defined in the current environment, provides the
necessary default.
LC_NUMERIC If this environment is set and valid, uses the international language database named in the definition to determine radix
character rules.
LANG If this environment variable is set and valid uses the international language database named in the definition to determine
collation and character classification rules. If or is defined, their definitions supersede the definition of LANG.
Examples
The following shows an example of using the function:
scanf("%2$s %1$d", integer, string)
If the input is `` january 9 '', the function assigns 9 to and ``january'' to
Return Values
The function returns the number of successfully matched and assigned input fields. This number can be zero if the function encounters
invalid input characters, as specified by the conversion specification, before it can assign input characters.
If the input ends before the first conflict or conversion, returns EOF. These functions return EOF on end of input and a short count for
missing or invalid data items.
Environment
In POSIX mode, the E, F, and X formats are treated the same as the e, f, and x formats, respectively; otherwise, the upper-case formats
expect double, double, and long arguments, respectively.
See Also
intro(3int), setlocale(3), strtod(3), strtol(3), printf(3int), getc(3s), printf(3s), scanf(3s)
Guide to Developing International Software
scanf(3int)