[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: [PROGRAMMERING] Segfejl under kørsel, menikke når jeg debugger!



On Wed, 23 Jun 2004 11:05:53 +0200
Søren Egmose <sslug@sslug> wrote:

> Hvis vi nu skal være pedantiske:
> 
>    char type[sizeof(int) * 25] = ""; 

"" Angiver en tekst streng, den går ikke.

Du skal bruge 0 eller '\0'

Jeg ville dog bruge memset til sådanne ting, i det jeg vil være sikker på at min hukommelses mængde er kom.

Således

memset(type, '\0', 25);

Den er desuden også god at benytte når vi snart structs/objecter.

> initialisere type ellers vil strcat potentielt lave 
> bufferoverrun, hvis type ikke er nulstillet, det er 
> vist ikke portable at den er det.

Medmindre man benytter strncat.

Bo


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 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] *