You are trying to use s as a string but you only allocate enough storage for 3 chars, you don't initialise the array to all '\0' and your loop allows 3 chars to be read and will also terminate on a '\r' so unless the third char is a '\0' the string will not be null terminated.
You will most likely see garbage or a corruption of your data when output.
atoi will also fail.
All times are GMT - 6 Hours Goto page Previous1, 2
Page 2 of 2
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum