I'd like to find out if there's a way to limit the input read by scanf. I'm trying to read an input string from the user and then pass it to atof to produce a value (of type double). According to MSDN, atof only reads the first 100 chars, so I'd like to limit user input to that.

I've tried "scanf("%100c", szValue);" but this does not physically restrict the number of characters the user can write. I've also looked into writing my own scanf-style function that limits the input, but cannot handle control codes such as backspace.