caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: caml-list@inria.fr
Subject: scanf %n may return 1 too much?
Date: Wed, 29 Mar 2006 11:50:32 +0200	[thread overview]
Message-ID: <17450.22632.908386.937520@ithif59.inf.tu-dresden.de> (raw)

Dear all,

is the following really the intented behaviour?

# Scanf.sscanf " a" " %n" (fun n -> n);;
- : int = 2
# Scanf.sscanf " a" " a%n" (fun n -> n);;
- : int = 2

In the first one only one character is consumed, it should IMO
return 1. The second one consumes one character more than the
first one. So it should return one more than the first one.

How can I scan _precisely_ one space without the look ahead
behavior that the format " " apparently has? I guessed "% ", but
that raises an exception.

Bye,

Hendrik


             reply	other threads:[~2006-03-29  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-29  9:50 Hendrik Tews [this message]
2006-03-29 10:03 ` [Caml-list] " Michael Wohlwend

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=17450.22632.908386.937520@ithif59.inf.tu-dresden.de \
    --to=tews@tcs.inf.tu-dresden.de \
    --cc=caml-list@inria.fr \
    /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).