🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2396

Re: fscanf problem

#2396
From: Tanmoy Bhattacharya
Date: Wed, 27 Mar 1996 00:59
48 lines
2688 bytes
In article <4imaao$dsi@solutions.solon.com>
sg7248613@omega.ntu.ac.sg writes:

s: I have been trying to read a section of data from a file for days.
s: 
s: The data segment goes like this:
s:     .....
s:     Patch norm0 4 { { 0 -1 0 } { 0 -1 0 } { 0 -1 0 } { 0 -1 0 } }
s:     Patch vert0 4 { { 0 1 0 } { 1 1 0 } { 1 1 1 } { 0 1 1 } }.
                                                                ^
The format string makes no allowance for the last character above.

s:     .....
s: My actual code segment is as follows:
s: 
s: fscanf(meshf, "    Patch %s %d { { %f %f %f } { %f %f %f } { %f %f %f }\
s:             { %f %f %f } }\n    Patch %s %d { { %f %f %f } { %f %f %f }\
s:             { %f %f %f } { %f %f %f } }\n", pptr->nname, &(pptr->numVert),
s:             &tmpf[0], &tmpf[1], &tmpf[2], &tmpf[3], &tmpf[4], &tmpf[5],
s:             &tmpf[6], &tmpf[7], &tmpf[8], &tmpf[9], &tmpf[10], &tmpf[11],
s:             pptr->vname, &tmpi,
s:             &tmpg[0], &tmpg[1], &tmpg[2], &tmpg[3], &tmpg[4], &tmpg[5],
s:             &tmpg[6], &tmpg[7], &tmpg[8], &tmpg[9], &tmpg[10], &tmpg[11]);
s: 
s: The read of the first line is OK. But I can't scanf the second line
s: successfully. Could anyone please enlighten me on this? Thank you!

Please post short complete compilable examples when asking
questions. It is not clear to me what you mean by `I can't scanf the
second line successfully'. What happens? Does the program crash? Does
it print a message saying `I can't scanf the second line
successfully'? 

Which second line? The format would read two lines of the form that
you gave in one scanf. 

(I would have ignored such a vaguely worded post, but the other
followups I see are incorrect, so I had to respond.)

Cheers
Tanmoy
--
tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
<http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
Technical Details
Message-ID: <4ja3tv$pdl@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4imaao$dsi@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: tanmoy@qcd.Lanl.GOV (Tanmoy Bhattacharya)
Newsgroups: comp.lang.c.moderated
Subject: Re: fscanf problem
Date: 26 Mar 1996 18:59:42 -0600
Organization: Los Alamos National Laboratory
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4ja3tv$pdl@solutions.solon.com>
References: <4imaao$dsi@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com