Search:

Type: Posts; User: Click_here

Search: Search took 0.01 seconds.

  1. Replies
    133
    Views
    19,560

    Fair enough. Your examples don't cover*...

    Fair enough.

    Your examples don't cover* unbuffered input streams (like one would find on a microcontroller), but I think that you've proven your point

    *I think that "don't cover" is incorrect -...
  2. Replies
    133
    Views
    19,560

    Barney, it was good for you to provide that...

    Barney, it was good for you to provide that example for academic purposes.

    However, the bottom line is: There is no reason why you should be using "gets".
  3. Replies
    133
    Views
    19,560

    No My point is that a gun is always dangerous...

    No

    My point is that a gun is always dangerous and it is not designed to flick a light switch on and off - It is a job that you would use your hand for, but I have created a stupid, redundant way...
  4. Replies
    133
    Views
    19,560

    I wasn't talking about firing it at the light...

    I wasn't talking about firing it at the light switch - Just flicking the switch with it.
  5. Replies
    133
    Views
    19,560

    To me, it's like saying that a gun is safe,...

    To me, it's like saying that a gun is safe, because it can be used to turn on and off a light switch.
  6. Replies
    133
    Views
    19,560

    Just following on from laserlight - "strcpy"...

    Just following on from laserlight -

    "strcpy" does not have to have external input as it's arguments, "gets" does.
  7. Replies
    133
    Views
    19,560

    I read about gets_s in the C11 draft - But as you...

    I read about gets_s in the C11 draft - But as you said earlier, it's a draft. And point 6 for the gets_s function in that draft recommends the use of fgets instead of get_s anyway.
  8. Replies
    133
    Views
    19,560

    Strncpy is your best bet with a definition for...

    Strncpy is your best bet with a definition for the maximum string length.

    If you wanted to have a faster program, define the strings and separate pointers to point to them and then change where...
  9. Replies
    133
    Views
    19,560

    I think that that is bad advice in this case ->...

    I think that that is bad advice in this case -> Think about this example


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>


    #define STR_MAX 16
  10. Replies
    133
    Views
    19,560

    Do NOT use "gets"

    Do NOT use "gets"
  11. Replies
    133
    Views
    19,560

    I wouldn't worry about that mistake -> It is...

    I wouldn't worry about that mistake -> It is quite common for people just learning C to get arrays and pointers mixed up.

    Also note how I've declared main as "int main" - And I have given it a...
  12. Replies
    133
    Views
    19,560

    This is what I meant - And I neatened up your...

    This is what I meant - And I neatened up your code. Enjoy.


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>


    #define STR_MAX 16
  13. Replies
    133
    Views
    19,560

    You are declaring a,b,c,d as pointers. If you...

    You are declaring a,b,c,d as pointers.

    If you declare them as string literals, you may not modify them.

    You will need to declare them as arrays large enough to hold the biggest string.


    ...
Results 1 to 13 of 13