About 5,930,000 results
Open links in new tab
  1. stdin - fgets () function in C - Stack Overflow

    I know everybody has told me to use fgets and not gets because of buffer overflow. However, I am a bit confused about the third parameter in fgets(). As I understand it, fgets is dependent on: ch...

  2. C - scanf () vs gets () vs fgets () - Stack Overflow

    Jul 10, 2015 · Generally you should use fgets instead, although it's sometimes inconvenient (you have to strip the newline, you must determine a buffer size ahead of time, and then you must figure out what …

  3. How to use fgets to read a file line by line - Stack Overflow

    Jan 28, 2017 · 1 I'm new at programming so there are some basics and maybe common sense that I don't know. I have a question about how to use fgets right. Based on the explanation of fgets, it …

  4. c - Difference between scanf () and fgets () - Stack Overflow

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

  5. c - Reading from file using fgets - Stack Overflow

    I am reading from file of format 1 32 43 23 32 43 123 43 54 243 123 2222 2 Here is my code snippet. string [100]; while (!feof (fp)) fgets (string,100,fp) Now, when I put every string, in the last

  6. Should I use fgets or scanf with limited input in c?

    Nov 23, 2021 · Should I use fgets or formatted scanf like scanf("%10s", foo). Excepted that scanf does not read blank characters, which can be solved and do more stuffs with scanset, then why I should …

  7. c - How to read from stdin with fgets ()? - Stack Overflow

    I've written the following code to read a line from a terminal window, the problem is the code gets stuck in an infinite loop. The line/sentence is of undefined length, therefore I plan to read it...

  8. Why is the gets function so dangerous that it should not be used?

    Unlike fgets, gets_s maintains a one-to-one relationship between input lines and successful calls to gets_s. Programs that use gets expect such a relationship. The Microsoft Visual Studio compilers …

  9. c - Using fscanf () vs. fgets () and sscanf () - Stack Overflow

    In the book Practical C Programming, I find that the combination of fgets() and sscanf() is used to read input. However, it appears to me that the same objective can be met more easily using just the …

  10. How to use fgets () without resulting in bug and also include '.' in ...

    Oct 26, 2023 · How to use fgets () without resulting in bug and also include '.' in the same line of the output? Asked 2 years, 1 month ago Modified 2 years, 1 month ago Viewed 402 times