Re: _itoa( )

From: Robert Stankowic (pcdoktor_at_netway.at)
Date: 10/09/03


Date: Thu, 9 Oct 2003 09:30:23 +0200


"Josh Sebastian" <curien@cox.net> schrieb im Newsbeitrag
news:pan.2003.10.09.00.33.06.925343@cox.net...
> On Wed, 08 Oct 2003 19:13:57 -0500, brigham white wrote:
>
> > Oh, sorry I'm a bit naive about the issue, I thought since you needed
> > stdlib.h to use it that it was standard.. can you tell me where to go?
>
> Try a group that discusses your compiler. I'm guessing it's MS VC++, in
> which case you want microsoft.public.vc.language. MS prefixes their
> non-standard functions with an underscore, so if it starts with an
> underscore, even if it's in a standard header, it's probably a
> compiler-specific extension.

OP:
Does char *_itoa( int value, char *string, int radix ) allocate the buffer
for string? or does the caller need to?
    ^^^^^^
Beat me if I'm wrong, but IMHO the question can be answered from the
prototype, and the answer is topical here:

char *_itoa( int value, char *string, int radix );
                        ^^^^^^^^^^^^
a pointer to char is passed by value, therefore the caller _must_ allocate
the buffer, there is no way for the callee to allocate the string.

kind regards
Robert



Relevant Pages

  • Re: string function
    ... ] np(new string).. ... function returns a char* result, I assume the latter; ... you don't allocate any memory. ... overwrite s *and* if np is no longer than p. ...
    (comp.lang.c)
  • Re: string compare
    ... short int length; ... char data; ... You can have the caller of the library routines specify which type ... Well what if someone wants to compare a short string with a long ...
    (comp.lang.c)
  • Re: pointer arithmetic help
    ... char * kernel_buf; ... No storage has been allocated for the 5 characters you are trying to copy ... for user_buf the compiler allocates storage for the string. ... You must allocate storage... ...
    (comp.lang.c)
  • Re: NLS_LENGTH_SEMANTICS=CHAR and column storage size
    ... Maxim Demenko schrieb: ... that means for char column for example charwill allocate 2000 bytes and charwill allocate 2000 bytes as well. ... It means charwill require 20 bytes *only* if you store there a string of 5 fourbytes characters. ...
    (comp.databases.oracle.misc)
  • String array
    ... I am coding a function that takes a string as an ... stored in (char ***fragments) which is passed as an argument. ... GDB to see the caller, the second element of the array is either null ...
    (comp.lang.c)