[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] Returnerin af at "string" array



On Thu, 8 Feb 2001, Carsten Svaneborg wrote:

> >         while(retCode != NULL){
> >                 retCode = fgets(Line, 200, logfile);
> 
> 200 bør være 199 fordi du skal have plads til det 0 der viser hvornår
> strengen slutter.

Jeg er enig i stort set alle dine betragtninger, men:

man fgets

 fgets()  reads  in  at  most one less than size characters
       from stream and stores them into the buffer pointed to  by
       s.  Reading stops after an EOF or a newline.  If a newline
       is read, it is stored into the buffer.  A '\0'  is  stored
       after the last character in the buffer.                      

Så, 200 er vel korrekt nok.

Mads

> > Håber der er nogen der kan gennemskue mit problem =) Som sagt er jeg helt
> > ny i C og det program jeg er ved at skrive er en port af et java program
> 
> Det er en ordentlig omgang du har rodet dig ud i. Hvis ovenstående
> ikke er klart, så råb op.

Eller, hvorfor ikke prøve med C++ - hvis du bruger stdl kan du slippe for
mange af problemerne.... (måske).

Mads

-- 
Mads Bondo Dydensborg.                               sslug@sslug
You know you're a Linux geek when...

    When you hear the words 'Fresh meat' you think of software.
    
                                                     - segfault



 
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] *