[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] Sti til eksekverbar



On Tue, 22 Jul 2003 11:58:55 +0200
Robert Larsen <sslug@sslug> wrote:

> Hey
> 
> Er det muligt at finde den fulde sti til den fil, som eksekverer ?
> 
> int main(int argc, char ** argv)
> {
> 	printf("%s\n",argv[0]);
> 	return 0;
> }
> 
> Ovenstående giver kun filnavnet hvis ikke man selv har skrevet hele stien, 
> og hvis man kører programmet gennem et symbolsk link får man stien til 
> denne. Jeg har lagt nogle ressourcer i samme bibliotek som programmet og 
> vil gerne kunne finde frem til dem uden at skulle hardcode for meget.

Altså du mener, hvis du spørger med getcwd(3) så får du symlink
stien? Jeg har scriptet mig til en løsning engang, men har den
desværre ikke lige her, det var noget med at vandre tilbage
gennem stien og så derved opdage symlinks.

Hvad siger man getcwd(3) Den henviser til noget mere infor og siger,
at du også kan kigge i /proc/self/cwd -- jeg har desværre ikke tid
at følge op på mere lige nu.

Hilsen


-- 
sslug@sslug -- Linux works for me.  http://d-axel.dk/


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

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