[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] _itoa



Sune Fischer wrote:
> 
> Et lidt fjollet spørgsmål, men jeg skal bruge den inverse funktion til
> atoi. Jeg ved ikke hvad den hedder, i win hedder den _itoa og
> konverterer altså en integer til streng. Kan ikke finde den under man
> pages.

itoa er vist en skummel Borland opfindelse. Kig på sprintf.

> Er der nogen meninger om hvad der er det bedst valg af disse to
> metoder:
> 
> char* buffer;
> ....
> buffer=new char[x];
> ....
> delete [] buffer;
> 
> og den anden metode med calloc:
> 
> buffer = (char *)calloc( x, sizeof( char )
> ..
> free( buffer );
> 
> Findes der en måde at reskalere arrayen på uden først at slette den og
> oprette den igen?

At den første er C++, og den sidste er C/C++ ved du formodentlig godt?
Jeg kan ikke lige huske om new "nullificerer" det allokerede, ligesom
calloc gør.

Med new får du den egenskab at du ikke behøver cast'e til den ønskede
type.

Mht. reallokering så prøv at kigge på realloc.

Mvh Morten


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:07 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *