[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] Problem i god gammeldaws c



Hej Søren,

du skal arbejde med en pointer-til-pointer da en pointer svarer til en int 
der bliver kopieret ved funktionskald så du får kun allokoret til den 
temporære variabel

"Søren H. Sørensen" <sslug@sslug> wrote on 14-08-2009 13:49:32:

> From:
> 
> "Søren H. Sørensen" <sslug@sslug>
> 
> To:
> 
> sslug@sslug
> 
> Date:
> 
> 14-08-2009 13:53
> 
> Subject:
> 
> [PROGRAMMERING] Problem i god gammeldaws c
> 
> Hej alle.
> 
> Gad vide om nogen her kan huske god gammel K&R c. Åbenbart kan jeg vist 
> ikke, så derfor er jeg rendt panden ind i et problem med noget simpel 
> pointer-gymnastik.
> 
> Man tager en global variabel:
> struct liste *anchor1=NULL;
> 
> Så laver man en funktion som
> void scandirec( char *path, struct liste *pntr, int number )
void scandirec( char *path, struct liste **pntr, int number )

> 
> Den kalder man med
> scandirec("/dosf/Ripped/mp3-nye/For Fuld Musik 1-1", anchor1, 0);
scandirec("/dosf/Ripped/mp3-nye/For Fuld Musik 1-1", &anchor1, 0);

> 
> Nede i scandirec laver man så en
> pntr=calloc(1, sizeof(struct liste));
&pntr=calloc(1, sizeof(struct liste));

> 
> Og tror nu variablen anchor1 bliver adressen på en buffer - det gør den 
> ikke. Den forbliver NULL. Hvorfor???
> Forresten har pntr faktisk en plausibel værdi indenfor scandirec.
> 
> Jeg kan sagtens by-passe problemet, men der må være noget grundlæggende 
> jeg har glemt.
> 
> Mange venlige hilsner
> Søren H. Sørensen
> 


Med venlig hilsen / Kind regards



Nils Åke Ljunggren
Senior Strategic Developer




Office: 
Fax: 
Email: 

+45 7023 2328
+45 7023 8329
sslug@sslug
Strandvejen 104A
2900 Hellerup
Denmark
www.zylinc.com



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2009-09-01, 02:01 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] *