avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [support #102994] problems using scanf and fgets, perhaps


From: Markus Floh
Subject: [avr-libc-dev] [support #102994] problems using scanf and fgets, perhaps because of malfuncton of malloc?
Date: Sat, 10 Apr 2004 11:36:56 -0400
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

This mail is an automated notification from the support tracker
 of the project: AVR C Runtime Library.




/**************************************************************************/
[support #102994] Full Item Snapshot:

URL: <http://savannah.nongnu.org/support/?func=detailitem&item_id=102994>
Project: AVR C Runtime Library
Submitted by: Markus Floh
On: Sat 04/10/04 at 15:36

Category:  None
Priority:  5 - Normal
Severity:  1 - None
Resolution:  None
Assigned to:  None
Originator Email:  
Status:  Open


Summary:  problems using scanf and fgets, perhaps because of malfuncton of 
malloc?

Original Submission:  Hello all,
First of all I want to say I´m relatively new to all that stuff concerning 
programming with linux tools and avr, somehow a greenhorn, and so I would like 
you to forgive me if I do some beginner failures (perhaps in using the 
homepage, I´d surely aprecitate some help).

I have been using avr-libc-1.0 since months successfully without problems. I´ve 
tried version 1.0.3 as well. I want to use scanf() on the m16 and m162, but it 
doesnot work properly, getc() works pretty fine. 

What I´ve found out is that the function scanf and also fgets return values 
none-EOF even though no character was entered. 
When calling ferror() it returns always value 16, since registering the device 
with fdevopen() but I don´t know if this function is already implemented.
Even clearing the error flag with function clearerr() doesn´t help. Does anyone 
know what this errorvalue of decimal 16 means? Perhaps this may help.

As I said printf works fine but when printing out a string read in with scanf, 
it seems that no NULL terminator is provided since printf prints out nonsense 
till '' is found.

As said in Summary it could be possible that malloc has something to do with 
that, because I have recognized, that downloading a new software (clearing 
section data and bss) into the chip, doesnot clean the input data scanf 
returns, of course I know that malloc doesnot clean the requested data but it 
is some kind of suspect that scanf returns the same data entered before 
downloading, perhaps it is a problem between malloc and scanf.

Can anyone help me?
















For detailed info, follow this link:
<http://savannah.nongnu.org/support/?func=detailitem&item_id=102994>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]