Sponsored Content
Full Discussion: Scanf problem under LINUX...
Top Forums Programming Scanf problem under LINUX... Post 19749 by PxT on Tuesday 16th of April 2002 11:18:28 AM
Old 04-16-2002
Change the "scanf %c" to "scanf %s" and see what happens....
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

linux boot problem

i have instaled a boot loader and win98 on drive c: and linux on drive d: and when i go to boot with the loader into linux nottin happens.is there some way i should install lilo to let it boot of a loader on drive c: ? (5 Replies)
Discussion started by: perleo
5 Replies

2. UNIX for Dummies Questions & Answers

Linux Redhat 8.0 Problem

can someone tell me what commands in Linux RedHat 8.0 will give me a graph of whats going on on my system. When Is ay graphs I mean graphs like does produced by perfview of solaris and glance of HP-UX. (3 Replies)
Discussion started by: TRUEST
3 Replies

3. Programming

scanf with strings... please help

hi i am a beginner to C i have encountered a problem with my assignment, and i have researched it on the internet, but unfortunately i didn't find anything related to that. i am writing a simple program that takes user's input by prompt command, and parse the whole line into an array of... (1 Reply)
Discussion started by: inkfish
1 Replies

4. Programming

scanf doesn´t reads spaces ???

hi all i have a program in C (Unix Solaris 5.7) and i want to read a string from keyboard, but the "scanf" doesn´t reads spaces. example: .... char name; .... printf("Enter your name: "); scanf("%s",&name); printf ("Your name is: %s", name); and if i write Kevin Costner ... (4 Replies)
Discussion started by: DebianJ
4 Replies

5. Programming

problem with scanf

hi all! i've written a simple c program: #include<stdio.h> #include<stdlib.h> int main() { int a; char b; char c; ... (4 Replies)
Discussion started by: mridula
4 Replies

6. Programming

simple scanf issue ?

Hello everyone, I hope someone is awake to help me on this.. hey How can I do something like this: The user is asked is asked to enter an int value, but I want to provide a default value on stdout, which they can back space and change it to whatever they want.. for e.g: Enter the... (4 Replies)
Discussion started by: the_learner
4 Replies

7. Programming

Better than scanf

I don't know how to do this: printf("creazione nuovo messaggio\n"); printf("insert dest\n"); scanf("%s",dest); printf("insert object\n"); scanf("%s",ogg); printf("inserire text\n"); scanf("%s",test); ... (7 Replies)
Discussion started by: italian_boy
7 Replies

8. Programming

What is the difference between printf and putchar() or scanf and getchar() ?

Im a newbie to programming language, i found tat there r these function called printf and putchar() as well as scanf and getchar(), im curious abt why do dey hav these 2 different function although dey r doing the same instruction? :confused: (13 Replies)
Discussion started by: kris26
13 Replies

9. Shell Programming and Scripting

Passing argument 1 of 'scanf' makes po

$ cc Array.c Array.c: In function ‘main’: Array.c:23: warning: passing argument 1 of ‘scanf’ makes po Array.c:25: error: expected expression before ‘return’ Array.c:29: error: expected expression before ‘return’ Array.c: At top level: Array.c:44: error: expected ‘)’ before ‘&’ token... (8 Replies)
Discussion started by: sgradywhite
8 Replies

10. Programming

Scanf() string pointer problem

I have a problem with scanf() for string pointer as member of a struct. #include <stdio.h> #include <stdlib.h> struct Student { int studentNumber; int phoneNumber; char *studentName; //line 7 // char studentName; //line 8 }; int... (10 Replies)
Discussion started by: yifangt
10 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)
All times are GMT -4. The time now is 09:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy