Re: undefined 'lseek' whem converting CW8->CW9
- From: Alexey Proskuryakov <ap@xxxxxxxxxxxxxxxxx>
- Date: Thu, 21 Jul 2005 11:38:51 +0400
On 20.07.2005 23:33, in article
1121888024.908730.135530@xxxxxxxxxxxxxxxxxxxxxxxxxxxx, "brianhray@xxxxxxxxx"
<brianhray@xxxxxxxxx> wrote:
> char * itoa(unsigned n, char *s, int rad)
> {
> #pragma unused(rad) // taken care of by sprintf
> sprintf(s, "%d", n);
> return s;
> }
>
> But I am unsure that the radix is actually being taken care of my
> sprintf.
Here, the radix is always 10 (I'd put an assert() instead of the pragma).
For octal and hexadecimal, there are %o and %x.
> Did you say these are available in libc?
What I meant was that unless you need something other than octal, decimal
and hexadecimal, you can replace all instances of itoa with equivalent
sprintf's. Completely reimplementing itoa in terms of standard C/C++ is
slightly harder (I made a quick Google search, and found an example here
<http://www.daniweb.com/techtalkforums/threadedpost54281.html>).
I do not know any reason why C/C++/POSIX do not have itoa, given that
strtol is standard, and supports various bases. Perhaps I'm missing
something...
- WBR, Alexey Proskuryakov
.
- References:
- undefined 'lseek' whem converting CW8->CW9
- From: brianhray@xxxxxxxxx
- Re: undefined 'lseek' whem converting CW8->CW9
- From: Josef W. Wankerl
- Re: undefined 'lseek' whem converting CW8->CW9
- From: brianhray@xxxxxxxxx
- Re: undefined 'lseek' whem converting CW8->CW9
- From: Alexey Proskuryakov
- Re: undefined 'lseek' whem converting CW8->CW9
- From: Peter Paulus
- Re: undefined 'lseek' whem converting CW8->CW9
- From: Alexey Proskuryakov
- Re: undefined 'lseek' whem converting CW8->CW9
- From: brianhray@xxxxxxxxx
- undefined 'lseek' whem converting CW8->CW9
- Prev by Date: Re: undefined 'lseek' whem converting CW8->CW9
- Next by Date: Re: Getting error with "rez"
- Previous by thread: Re: undefined 'lseek' whem converting CW8->CW9
- Next by thread: Re: undefined 'lseek' whem converting CW8->CW9
- Index(es):
Relevant Pages
|