You make need to write the line as: ultoa(100000UL,dummytext,10);
I've had the compiler complain about overflows (when I multiplied 2 constants together to make a long constant) where the constant was cast just fine using another compiler. Dale Frank Schroeder MHF-sl wrote:
Hello, I have tried to convert an unsigned long int to ascii using the function char * ultoa (unsigned long int __val, char *__s, int __radix) of stdlib.h. This function converts only the lower two bytes of the unsigned long, like it were a normal unsigned. I have tried with this line: ultoa((unsigned long)100000,dummytext,10); And the result in dummytext is "34464" (the lower two bytes of 100000) (checked with Debugger DDD, while the MSP430 is conected via JTAG). In my opinion it should be "100000". I work with an MSP430F149 under Debian. Maybe you can check the command on your system and give me a possible solution. Is it a bug or have i done something wrong? Thanks for quick answers, Frank Schröder ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Mspgcc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mspgcc-users
