Top "Scanf" questions

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

Reading file using fscanf() in C

I need to read and print data from a file. I wrote the program like below, #include<stdio.h&…

c file readfile scanf
Getting multiple values with scanf()

I am using scanf() to get a set of ints from the user. But I would like the user to …

c scanf
Read int values from a text file in C

I have a text file that contains the following three lines: 12 5 6 4 2 7 9 I can use the fscanf function to read the …

c file file-io scanf line
printf not printing on console

I’m getting started in the C language. I am using eclipse (juno) as my IDE and installed CDT plugin. …

c eclipse gcc printf scanf
How can I read an input string of unknown length?

If I don't know how long the word is, I cannot write char m[6];, The length of the word is …

c scanf
How do you read scanf until EOF in C?

I have this but once it reaches the supposed EOF it just repeats the loop and scanf again. int main(…

c scanf eof
How to scanf only integer?

I want the code to run until the user enters an integer value. The code works for char and char …

c scanf
What is the difference between sscanf or atoi to convert a string to an integer?

gcc 4.4.4 c89 What is better to convert a string to an integer value. I have tried 2 different methods atoi and …

c scanf atoi
How to read from input until newline is found using scanf()?

I was asked to do a work in C when I'm supposed to read from input until there's a space …

c format scanf