[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] system()




Thomas Rasmussen wrote:
> 
> Jeg er ved at lave en editor hvorfra man skal kunne afvikle gcc compileren, på den fil man editerer, fra et menupunkt.
> Jeg benytter i øjeblikket noget i stil med følgende kode:
> 
>                 system("gcc main.c -o main");
> 
> Men hvad hvis der er fejl i main.c, hvordan får jeg fat i output fra gcc compileren?
> Jeg kan selvfølgelig benytte en temporer fil og så indlæse den:
> 
>                 system("gcc main.c -o main > /tmp/gccERROR.txt");
> 
> Men er der ikke en smartere måde at gøre dette på?
> 
> MVH
> Thomas

Hej.....

Faktisk er der nok ikke en ret meget smartere måde at gøre det på, men
husk, at du kun behøver at læse i den temporære fil, hvis
"system"-kaldet returnerer noget der ikke er nul. "system" returnerer en
"int" med en status fra den utility den aktiverer. Da gcc kan terminere
en make ved en fejl, må den også returnere en fejlkode hvis den ikke er
tilfreds.

M.v.h.
Søren H. Sørensen

real Programmers have calloc's for breakfast


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

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