And what happens if the user leans on the keyboard producing more than 99 chars?
Yes, I agree it's the users fault for leaning on the keyboard, leaving something like thisin the filename, but it's still bad practice to use input functions that allow the application to crash with an error message when the user happens to input too much data.Code:gfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
And why do you believe that a filename should always be less than 99 chars? Admittedly it's unpractical, but MAX_PATH in windows is 260 chars, and in Linux somehting like 1024 chars - so if the OS can support the filename, why should your application deny it from being used in your app?
"string" is not a concept that really exists in C, as it is part of C++. None of your other code is C++.
--
Mats