linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Webb <rcsw@periscon.com>
To: Elias Athanasopoulos <eathan@otenet.gr>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: parsing with fscanf().
Date: Wed, 11 Sep 2002 23:14:26 +0100	[thread overview]
Message-ID: <200209112314.47300.rcsw@periscon.com> (raw)
In-Reply-To: <20020911212428.A1167@neutrino.particles.org>

[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Using flex :

%%
[,\t]+          putchar(',');
[,\t]+$		

will replace multiple commas and tabs with a single comma.

R.

On Wednesday 11 September 2002 7:24 pm, Elias Athanasopoulos wrote:
> Hi,
>
> A really newbie question, but I have no time for research (my deadline
> is counted in hours).
>
> I have to parse a text file, which has been exported from MS Excel (I
> have no access to this thingie) using TABs as delimeters. The text
> is like:
>
> 4	3	2.0
> 5		1.2
> 4	3	2.4
>
> I use fscanf() to insert the data to my structures, but the "gap" (between
> 5 and 1.2) breaks the sequence. fscanf() places the 3rd column to the 2nd
> field in my structure.
>
> Is there a trivial way to bypass the problem using fscanf() or I have to do
> the parsing using read()?
>
> Elias
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9f8BJbwZ8a5Bkl7QRArNfAJ0RwoHwJvl8DPlXYQld7rZdDOnTYQCfeJL8
fQ+CUQycjmtZ0iLxOKlZHXc=
=Jolb
-----END PGP SIGNATURE-----

[-- Attachment #2: public_key.asc --]
[-- Type: application/pgp-keys, Size: 1665 bytes --]

      parent reply	other threads:[~2002-09-11 22:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-11 18:24 parsing with fscanf() Elias Athanasopoulos
2002-09-11 19:36 ` Glynn Clements
2002-09-11 20:08   ` Elias Athanasopoulos
2002-09-12  7:25     ` Mohammed Khalid Ansari
2002-09-12  7:21       ` Carlos Fernández
2002-09-11 22:14 ` Richard Webb [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200209112314.47300.rcsw@periscon.com \
    --to=rcsw@periscon.com \
    --cc=eathan@otenet.gr \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).