Re: Integer Manipulations [OT]



Are there any better ways of doing it? Also the "itoa" function gives
trouble while compiling and says undefinied reference. Need help please.

Well strtol is often better then atoi - it has more sanity checking and
you can take advantage of multiple bases easier (setting base '0' is a
good idea).

There is no itoa for the simple reason that would have to allocate a
varaible amount of memory - not in the style of C standard libraries.  I
suggest you have a look at the various glib functions for operating on
strings - in particular the g_*_sprinf functions, as well as the C
standard library version - sprintf (which can be unsafe is used
unwisely).

        Regards,
        nash
        [Just finished marking 60 programming assignments...]
-- 
Brett Nash <nash nash nu>
Sometimes it's better to light a flamethrower than curse the darkness.



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