Top "Scanf" questions

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

Fscanf or Fgets? Reading a file line after line

i have to write a program in C to read a file containing several line of text, each line contains …

c fgets scanf
read comma-separated input with `scanf()`

I have the following input: AG23,VU,Blablublablu,8 IE22,VU,FooBlaFooBlaFoo,3 and so on... I want it to "parse" with …

c csv input file-io scanf
equivalent of Console.ReadLine() in c++

My teacher just gave me an assignment in c++ and I am trying to get a string with scanf but …

c++ string scanf readline
Difference between scanf() and fgets()

I want to know what is the difference between fgets() and scanf(). I am using C as my platform.

c scanf fgets
What does `scanf("%*[^\n]%*c")` mean?

I want to make a loop in C that, when the program asks for an integer and the user types …

c user-input scanf format-specifiers
scanf("%[^\n]s",a) vs gets(a)

I have been told that scanf should not be used when user inputs a string. Instead, go for gets() by …

c scanf gets
Why is scanf() causing infinite loop in this code?

I've a small C-program which just reads numbers from stdin, one at each loop cycle. If the user inputs some …

c gcc scanf
Reading a line using scanf() not good?

scanf(" %[^\n]",line); A friend of mine suggested that using fgets() to read a line as input would be a …

c scanf stdio
Disadvantages of scanf

I want to know the disadvantages of scanf(). In many sites, I have read that using scanf might cause buffer …

c input user-input scanf
warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)’

I am trying to run a simple C program but I am getting this error: warning: format ‘%s’ expects type ‘…

arrays c pointers scanf