🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #17459

Re: file lezen en schrijven

#17459
From: Joris Spriet
Date: Thu, 16 Dec 1999 00:00
24 lines
1307 bytes
Bart Vandewoestyne wrote in message <3859371D.5C47C8FC@skynet.be>...
>
>  fp = fopen("xydata1", "r");
>  while (fscanf(fp, "%d\n%d\n", &i, &motor_data)==1)   // hier gaat
>blijkbaar iets fout, maar wat ???
>    printf("%d\n", motor_data);
>  fclose(fp);
>  return (0);


fscanf() zal, als je leest uit een file die je geschreven hebt met je
voorgaande code, NOOIT 1, maar ALTIJD 2 retourneren, nl het aantal
velden dat het heeft kunnen toekennen.

Lees er de documentatie over scanf() en fscanf() maar eens op na...


"Each of these functions returns the number of fields successfully converted
and assigned; the return value does not include fields that were read but
not assigned"

Joris Spriet
j.spriet@unicall.be
Technical Details
Message-ID: <83bd8b$q26$1@trex.antw.online.be>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3859371D.5C47C8FC@skynet.be>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: 107324,c9f772b3ffe88dca
X-Google-Attributes: gid107324,public
X-Google-Thread: fcea4,c9f772b3ffe88dca
X-Google-Attributes: gidfcea4,public
From: "Joris Spriet" <j.spriet@unicall.be>
Subject: Re: file lezen en schrijven
Date: 1999/12/16
Message-ID: <83bd8b$q26$1@trex.antw.online.be>
X-Deja-AN: 561636431
References: <3859371D.5C47C8FC@skynet.be>
Organization: Customer of Online Internet
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Newsgroups: be.comp.programming,nl.comp.programmeren