Forum : ST7/STM8
Original Post
Post Information | Post |
---|---|
December 18, 2012 - 9:43pm
|
gets() must add null character at the end of string 0x81b8 <?gets> 0x89 PUSHW X PUSHW X 0x81b9 <?gets+1> 0x89 PUSHW X PUSHW X 0x81ba <?gets+2> 0xCD8178 CALL 0x8178 CALL getchar 0x81bd <?gets+5> 0x85 POPW X POPW X 0x81be <?gets+6> 0xA10A CP A,#0x0a CP A,#0x0a 0x81c0 <?gets+8> 0x2704 JREQ 0x81c6 JREQ 0x81c6 0x81c2 <?gets+10> 0xF7 LD (X),A LD (X),A 0x81c3 <?gets+11> 0x5C INCW X INCW X 0x81c4 <?gets+12> 0x20F3 JRT 0x81b9 JRT 0x81b9 0x81c6 <?gets+14> 0x85 POPW X POPW X 0x81c7 <?gets+15> 0x81 RET RET as far as I see, gets() does not add the string terminator STM8S105 mcu, small model, |
Indeed!
Fixed. Fix will be available in the next release.
Stéphane
As far as you're touching the code, I have two more feature requests:
- accept 0xd as end-of line
- make the gets() version with length control, (fgets with fake file?).
Is {s}scanf() going to be implemented?
gets accepts now \r as end-of-line character.
In the next release, RCSTM8 library will implement C11 char* gets_s(char* s, int n)
{s}scanf() is in the todo list, but I cannot promise it will be available.
Stéphane
Thanks, Stephane!
Wow, sscanf! Stéphane you are in good mood for doomsday...