Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. You need to clear the bad input or it will be...

    You need to clear the bad input or it will be read over and over again.


    #include <stdio.h>

    int main() {
    double d;

    while (puts("Enter a double: "), !scanf("%lf", &d))
    ...
  2. Replies
    5
    Views
    266

    As Malcolm said, an implementation doesn't need...

    As Malcolm said, an implementation doesn't need to be portable, so it can take advantage of the particular character set.

    The newlib implementation isn't as complicated as it seems. If the #else...
  3. Guess not. Good luck with that. It's such a...

    Guess not.
    Good luck with that.

    It's such a crybaby thing to whine that I didn't solve every single one of your requirements.
    Here you go:


    #include <stdio.h>

    int main() {
  4. Do you notice that your posted code looks bad?...

    Do you notice that your posted code looks bad? That's because you didn't post it as plain text.


    Longer is not generally more readable. Consider Mark Twain's famous quote: "I apologize for such...
  5. gets doesn't even exist in the current language...

    gets doesn't even exist in the current language spec.

    You should definitely use fgets since your input is basically "line based" where you only want one word on the line.

    One possibility:

    ...
  6. Replies
    2
    Views
    194

    Two possibilities. You either need to save the...

    Two possibilities. You either need to save the current number of used elements as an extra int in item, or you could use a special value to indicate unused elements (or at least the first unused...
  7. Replies
    10
    Views
    308

    It would be exactly what you originally posted....

    It would be exactly what you originally posted. The simplified example was supposed to make it easier to see what's going on.


    So?


    No. Yours has 5 arguments.


    I never asked about...
  8. Replies
    10
    Views
    308

    I doubt it's a bug in clang. It's unlikely that...

    I doubt it's a bug in clang. It's unlikely that they declared ReadFile and WriteFile to be void*, which seems to be what the error is saying.

    No, your conversion is wrong. You can't just mention...
  9. Replies
    8
    Views
    529

    You've lost me. I don't see any mention of...

    You've lost me. I don't see any mention of threads.

    A nitpick: you should probably remove the W at the end of strEvalResultW since that would usually indicate you are using CStringW...
  10. Replies
    10
    Views
    308

    The original code should work just fine as long...

    The original code should work just fine as long as ReadFile and WriteFile have been properly declared. Are you including <windows.h> ?
  11. Replies
    8
    Views
    529

    I don't see what this has to do with Unicode....

    I don't see what this has to do with Unicode.
    Nothing, apparently, or at least the underlying UTF-8 encoding is not part of your problem.
    But you obviously can't use strlen on a stringstream.
    How...
  12. Replies
    8
    Views
    529

    This seems to have very little (if anything) to...

    This seems to have very little (if anything) to do with Unicode.

    Are you knowingly using ATL/MFC?
    Are you sure you want to use CString (more specifically, for some reason, CStringA)?
    Using...
  13. Replies
    6
    Views
    366

    Order of evaluation - cppreference.com...

    Order of evaluation - cppreference.com
  14. Thread: buffer overflow

    by john.c
    Replies
    6
    Views
    293

    @flp1969, that's an interesting point. However,...

    @flp1969, that's an interesting point. However, without optimization, it still works even without the pointer (and getting rid of the printing of individual bytes). I think non-optimized code usually...
  15. Thread: buffer overflow

    by john.c
    Replies
    6
    Views
    293

    This works for me (without optimizations). ...

    This works for me (without optimizations).


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

    int main()
    {
    int n = 0;
  16. Replies
    2
    Views
    206

    It's hard for me to imagine a use case where I...

    It's hard for me to imagine a use case where I cared that an array was sorted but didn't care whether it was ascending or descending. Probably not worth a dedicated function.

    You could define...
  17. Replies
    6
    Views
    428

    @Exosomes, in glibc, if the "salt" starts with...

    @Exosomes, in glibc, if the "salt" starts with "$6$" then SHA-512 is used (and the salt is the letters from the second $ to the next $).
  18. Replies
    6
    Views
    428

    Thanks for the info. I took another look but...

    Thanks for the info. I took another look but still can't find the vulnerability. I'll probably take another look at it later today. Definitely let us know when you figure it out or are told. I wonder...
  19. Replies
    6
    Views
    428

    There doesn't seem to be any possible buffer...

    There doesn't seem to be any possible buffer overruns since all inputs use fgets calls and they are all properly limited. The strcats don't seem to be able to overflow either.


    Something strange...
  20. Replies
    3
    Views
    436

    What exactly did you do? (Post code/script.) How...

    What exactly did you do? (Post code/script.)
    How exactly did it not work?
  21. #include #include void...

    #include <stdio.h>
    #include <math.h>

    void Maclurin(float x, float es, int maxIter);

    int main()
    {
    Maclurin(1, 0.05 , 100);
    return 0;
    }
  22. Replies
    20
    Views
    796

    CHAR_BIT can never be less than 8. See 5.2.4.2.1...

    CHAR_BIT can never be less than 8.
    See 5.2.4.2.1 of the C11 standard.
  23. Replies
    4
    Views
    386

    Nobody tried to "figure it out".

    Nobody tried to "figure it out".
  24. Replies
    7
    Views
    441

    Your code doesn't make any sense. Presumably you...

    Your code doesn't make any sense.
    Presumably you mean something like this:


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

    char **f() // no need to pass the variable in
    {
  25. Replies
    13
    Views
    598

    Page 13 of N1570...

    Page 13 of N1570 says
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4