🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #3087

Re: structuren inlezen en wegschrijven (in c)

#3087
From: Kristoffel
Date: Sat, 14 Feb 2004 16:43
36 lines
1852 bytes
biffi wrote:
> ik heb eens een vraagje over de taal c,(beginner)
> 
> hoe kan je van een bepaald txt bestand een structuur inlezen als de
> woorden gescheiden zijn door spaties ? 
> 
> bv txt file is
> 
> telecom			telenet     antwerpen	120.0
> elektronica		ericsson    brussel		123.0
> .....
> 
> en de struct is:
> typedef struct
> 		{	float	omzet;
> 			char	naam[LEN];
> 			char	plaats[LEN];
> 			char	spec[LEN];
> 		} Bedrijf;
> 
> dus telecom moet in spec[LEN] komen, telenet in naam[LEN] enzo ...
> 
> alvast bedankt,
> Biffi. 

na
char	woord[500];
FILE *in;
in = fopen (...., "r");

     while ( fscanf( in, "%s", woord) != EOF)
     {
         /* uw algoritme */
     }

fclose (in);
Technical Details
Message-ID: <%esXb.1017$F66.186421@phobos.telenet-ops.be>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
References: <b6ds20hp66vcre9cbrq9fseo9k452022fp@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: fcea4,d07525d78edd6b7f
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2004-02-14 08:43:39 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
From: Kristoffel <kdg1955@yahoo.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: be.comp.programming
Subject: Re: structuren inlezen en wegschrijven (in c)
References: <b6ds20hp66vcre9cbrq9fseo9k452022fp@4ax.com>
In-Reply-To: <b6ds20hp66vcre9cbrq9fseo9k452022fp@4ax.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 36
Message-ID: <%esXb.1017$F66.186421@phobos.telenet-ops.be>
Date: Sat, 14 Feb 2004 16:43:39 GMT
NNTP-Posting-Host: 195.130.143.80
X-Complaints-To: abuse@telenet.be
X-Trace: phobos.telenet-ops.be 1076777019 195.130.143.80 (Sat, 14 Feb 2004 17:43:39 MET)
NNTP-Posting-Date: Sat, 14 Feb 2004 17:43:39 MET
Organization: Telenet Internet