Search:

Type: Posts; User: maxhavoc

Page 1 of 6 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    51
    Views
    13,676

    Citizen, there is really nothing wrong with your...

    Citizen, there is really nothing wrong with your solution except my admittedly rather arbitrary desire not to need so many lines of code every time I want input from the console. My application needs...
  2. Replies
    51
    Views
    13,676

    Okay, thanks for the help everyone. I think the...

    Okay, thanks for the help everyone. I think the lesson I'm taking home from this is don't program in C++ anymore if I ever want to have secure console input.
  3. Replies
    51
    Views
    13,676

    Ok, that will work so long as I can restrict the...

    Ok, that will work so long as I can restrict the number of characters read in from std::cin during the getline() call. Do you know how I can do that?
  4. Replies
    51
    Views
    13,676

    String does not have a gcount function. When I...

    String does not have a gcount function. When I try to use std::cin.gcount it returns -1.
  5. Replies
    51
    Views
    13,676

    Is there a way to limit the number of characters...

    Is there a way to limit the number of characters getline accepts? I know that std::string simply grows as large as it needs, but this could lead to denial of service attack through resource...
  6. Replies
    51
    Views
    13,676

    What would that do with the excess input in...

    What would that do with the excess input in std::cin? Just silently discard it?
  7. Replies
    51
    Views
    13,676

    tabstop, that is incredibly obnoxious. Is that...

    tabstop, that is incredibly obnoxious. Is that really the lengths that you need to go to so that you can accept input safely from the console? Every single time input is required? No wonder there are...
  8. Replies
    51
    Views
    13,676

    So what you're saying is do something like: ...

    So what you're saying is do something like:


    cin.get(inputString, 16);
    if (inputString[cin.gcount()] == '\n')
    good;
    else
    bad;
  9. Replies
    51
    Views
    13,676

    master5001, the problem with that approach is...

    master5001, the problem with that approach is that allows ONLY 16 characters, not up to and including 16 characters.
  10. Replies
    51
    Views
    13,676

    Ok, when I replace getline with get I no longer...

    Ok, when I replace getline with get I no longer need to decrement gcount by 1 to get the actual number of characters read however I still have the same issue with the infinite loop when the user...
  11. Replies
    51
    Views
    13,676

    The point of asking for help in a forum is to...

    The point of asking for help in a forum is to gain the benefit of peoples' experiences. I'm not going to input 2 million some odd characters to see if it breaks if someone else already knows the...
  12. Replies
    51
    Views
    13,676

    Er...I can never *know* there's going to be extra...

    Er...I can never *know* there's going to be extra input. I mean...there has to be a way to accept input safely in C++. There has to be a way to allow for input into a buffer with a fixed upper bound...
  13. Replies
    51
    Views
    13,676

    cin.ignore() asks for a number of characters to...

    cin.ignore() asks for a number of characters to ignore. Is it safe to pass a huge number like INT_MAX to it?
  14. Replies
    51
    Views
    13,676

    I've already dedicated too much time to this...

    I've already dedicated too much time to this program to replace all my char buffers with std::string. I know how char buffers work. I was mainly hoping there was a way to discard extraneous input...
  15. Replies
    51
    Views
    13,676

    Ok, I had an inkling that might be the issue. Is...

    Ok, I had an inkling that might be the issue. Is there anyway to flush stdin to get rid of any extra input?
  16. Replies
    51
    Views
    13,676

    Two problems with std::cin.getline()

    I am having two issues with the std::cin.getline() function.

    Here is the relevant portion of my code:


    std::cout << "Enter administrator password to unlock the database file" << std::endl;
    ...
  17. Ok, sorry guys, I'm a bit slow. Here's the...

    Ok, sorry guys, I'm a bit slow. Here's the function I've put together based on nonoob's answer:



    void stringToHex(unsigned char* hexString, char* string, int stringLength)
    {
    unsigned char...
  18. I don't think that will work. I'm reading in...

    I don't think that will work. I'm reading in characters from a file and I need to convert them to binary. I need one character in an unsigned char array to represent one byte (two characters) from a...
  19. How? The string is being read from a file with...

    How?

    The string is being read from a file with fgets() and being stored in a char*
  20. How to convert char string of Hex characters to unsigned char string of binary data

    I am trying to convert a hexadecimal character array to a binary string (unsigned char) that I can use in crypto functions using Cryptlib or OpenSSL. Basically I have a Hex representation of a key...
  21. Replies
    5
    Views
    2,530

    You're going to need to post a more specific...

    You're going to need to post a more specific question, give a code example of a particular if statement you are having trouble understanding.

    In general they work like this:



    if (condition)...
  22. Replies
    4
    Views
    2,784

    I'm not sure if this is the cause of the problem,...

    I'm not sure if this is the cause of the problem, but...



    #ifdef DRAWING_FUNCTIONS_H
    #define DRAWING_FUNCTIONS_H


    Should be...
  23. So you don't think Salem's Posix idea will work?...

    So you don't think Salem's Posix idea will work? Dammit Prelude, you make me sad. Salem seems really smart and he tricked me into thinking that Posix would be my panacea. Your relentless cynicism has...
  24. The problem is that I don't know how to do what I...

    The problem is that I don't know how to do what I need on every platform, that's why I just want to learn it one way that magically works across all platforms.

    And no, I don't plan to distribute...
  25. Do I need to download a Posix API separately?...

    Do I need to download a Posix API separately? Currently I'm developing under Visual Studio 6 and I can't find opendir or any related function in the MSDN.
Results 1 to 25 of 129
Page 1 of 6 1 2 3 4