🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #9045

Re: printf() en strings

#9045
From: Whizzo
Date: Tue, 28 May 2002 14:32
39 lines
2075 bytes
"Bart Baert" <bjbaert@news.rug.ac.be> wrote in message
news:aamb29$pcb$1@inf6serv.rug.ac.be...
> Kris Gaethofs (kris.gaethofs@student.kuleuven.ac.be) wrote:
> : Hoi,
>
> : Ik heb een klein programma geschreven in C en zit nu met een
> : probleempje. Ik definieer een pointer als volgt:
>
> : char *string;
>
> : Vervolgens lees ik uit een bestand in als volgt:
>
> : fscanf(inputfile,"%lf%lf%lf%s",&x,&y,&z,&string);
>
>
>
> Het moet dus zoiets worden:
>
>
> char string[50];
> fscanf(inputfile, "%lf%lf%lf%49s", &x,&y,&z, string);
> /* printf(string);  ??? */
>
> Aangezien er zonder de printf() geen core dump kwam, denk ik dat
> er in string niets is ingevuld. Het aantal velden dat
> men heeft gevonden wordt teruggegeven door fscanf().
> Je kan het volgende proberen.
>
> int res;
> char string[50];
> if ((res = fscanf(inputfile, "%lf%lf%lf%49s",&x,&y,&z,string)) != 4 ) {
> printf("fscanf heeft niet alle 4 velden kunnen terugvinden\n");
> return 1;
> }
> else
> printf(string);
>
 zo gaat het dus ook :)
Technical Details
Message-ID: <lyMI8.9838$yK2.1722808441@hebe.telenet-ops.be>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!skynet.be!skynet.be!ossa.telenet-ops.be!hebe.telenet-ops.be.POSTED!not-for-mail
References: <3CCE8BAB.20809@student.kuleuven.ac.be> <aamb29$pcb$1@inf6serv.rug.ac.be>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: fcea4,4cf3e2e3be91fbcb
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2002-05-28 07:33:12 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!skynet.be!skynet.be!ossa.telenet-ops.be!hebe.telenet-ops.be.POSTED!not-for-mail
From: "Whizzo" <askme@pandora.be>
Newsgroups: be.comp.programming
References: <3CCE8BAB.20809@student.kuleuven.ac.be> <aamb29$pcb$1@inf6serv.rug.ac.be>
Subject: Re: printf() en strings
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <lyMI8.9838$yK2.1722808441@hebe.telenet-ops.be>
Date: Tue, 28 May 2002 14:32:49 GMT
NNTP-Posting-Host: 213.119.150.111
X-Complaints-To: abuse@telenet.be
X-Trace: hebe.telenet-ops.be 1022596369 213.119.150.111 (Tue, 28 May 2002 16:32:49 CEST)
NNTP-Posting-Date: Tue, 28 May 2002 16:32:49 CEST
Organization: Telenet Internet