[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] [c] Læse fil med tre kolonner



OBS, der er lige en ting med returval, se nederst.

On Sun, 30 May 2004 21:05:59 +0000 (UTC)
Christian Nielsen <sslug@sslug> wrote:

> Tusind tak. Jeg lægger opskriften på nettet imorgen. Jeg havde forresten 
> forbyttet et c med et s i printf. Det var den egentlige årsag til jeg ikke 
> kunne få det til at virke.

Ja, jeg havde også rettet fra %c til %s i min kopi, det glemte jeg
at skrive. Men det er altså godt set af dig, at &text[i] giver det
samme som text[i], jamen altså!  Jeg har lige repeteret, jeg tror
nok at det er blevet til en officiel regel i C99, det er tilladt
at tage adressen (med '&') på et array, selv om det er overflødigt.

  printf("Addr. text[2] %p. Addr &text[2] %p\n",text[2], &text[2]);

(indsat i starten af programmet fra forrige mails) giver samme tal
to gange, altså, &text[i] er det samme som text[i]. Så må du selv
vælge notation. Den klassiske måde er som sagt at text[i] er
adressen på arrayet.

===========

return value fra sscanf (og de andre scanf) er antallet af items,
som kunne konverteres. Nu har jeg talt dem. Hvis en linie ikke
har de fem felter, som du forventer:

    if (returnval < 5) {
      error("Hov",0);
    }




-- 
donald_j_axel snabela get2net.dk -- http://d-axel.dk/


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