I'm using Keil uVision 3 for an embedded project. I want to read in from stdio (keyboard) using hyperterminal a string when prompted. It was recommended that I use fgets() because it could be set to a fixed length of characters.
gets() does not work well, I've already had issues with it.
My problem is that Keil does not have the full stdio.h library, it does not support the fgets() function, says that I need a standard prototype. I'm sure it uses lower level functions, but the only problem is that I can't seem to find a definition for fgets() anywhere to write my own.
I'm confused, why are you using hyperterminal? Wouldn't it make more sense to use your own application instead of trying to hook the keyboard while another application is supposed to have focus? Or am I not seeing the whole picture?
I'm sure gets does work, but if it really doesn't then according to the docs it is implemented with _getkey and putchar. So you should be able to roll your own.
It may also be worth noting the following paragraph if you didn't realise.
To use the existing _getkey and putchar routines, you must first initialize the 8051 serial port. If the serial port is not properly initialized, the default stream functions do not function. Initializing the serial port requires manipulating several special function registers (SFRs) of the 8051.