Top "Scanf" questions

Questions related to the scanf() family of functions in the C runtime library, which read and convert formatted data.

How to read numbers separated by space using scanf

I want to read numbers(integer type) separated by spaces using scanf() function. I have read the following: C, reading …

c input file-io scanf
sscanf in Python

I'm looking for an equivalent to sscanf() in Python. I want to parse /proc/net/* files, in C I could …

python parsing split scanf procfs
Reading a string with spaces with sscanf

For a project I'm trying to read an int and a string from a string. The only problem is sscanf() …

c string scanf
How to prevent scanf causing a buffer overflow in C?

I use this code: while ( scanf("%s", buf) == 1 ){ What would be the best way to prevent possible buffer overflow so …

c scanf buffer-overflow
What does the scanf function return?

I know that the signature of the scanf function is: int scanf(const char *format, ...) What is the int value …

c scanf
How to find EOF through fscanf?

I am reading matrix through file with the help of fscanf(). How can i find EOF? Even if i try …

c scanf
Reading long int using scanf

To read an int using scanf we use: scanf("%d", &i); What if i is a long not int?? …

c++ c stdin scanf
C - scanf() vs gets() vs fgets()

I've been doing a fairly easy program of converting a string of Characters (assuming numbers are entered) to an Integer. …

c scanf fgets gets
C: Multiple scanf's, when I enter in a value for one scanf it skips the second scanf

I have this block of code (functions omitted as the logic is part of a homework assignment): #include <stdio.…

c scanf
Reading a single character in C

I'm trying to read a character from the console (inside a while loop). But it reads more than once. Input: …

c scanf