From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 2303F7ED26 for ; Mon, 4 Jun 2012 20:59:27 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjkBAHcEzU/RVdSukGdsb2JhbABFtCcIIgEBAQEJCQ0HFAQjgjECExkBGx4DEhBdAREBBQEiNYdaAQMLlXuCYAkDjCKCcIRHChknDVeIcQEFDJEVA5UbiSCEeT6EAQ X-IronPort-AV: E=Sophos;i="4.75,714,1330902000"; d="scan'208";a="146536295" Received: from mail-wi0-f174.google.com ([209.85.212.174]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Jun 2012 20:59:26 +0200 Received: by wibhr14 with SMTP id hr14so2678275wib.9 for ; Mon, 04 Jun 2012 11:59:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Qnt3DEQtqNn9KAntN61A8GKZaTX+XFua7YryjXcd+cs=; b=ANVewDDLBaXwF+Yvh2WIR9eXq60posZQdSDILOVgDabi++oxyWSsaPbZbYuDpHGtJZ wwykokue1FYu5Mq36JJA5r851fCLTdBii2M3EE97auR5SAIaFZDi3kX3dwLHdXbKexEK 8F9DTvfMGkFtr/WFoHFZylXXykX4z79kJketXzE045USv5rPNfpuJiWA6U0jKcR2aE7n xS8KhDUi4CoPyQRO5oNFaZOS24ydsQ3C2Of6ZIUxdB1GiGgQNqN0IV1psBx5t8AVf1wi /u8F0cwg1JV58WjWuiCt8KsK78J5BDKyQub37KbKkQ9JzEraMMiIvcdHtetQuxExdsVD SqkQ== MIME-Version: 1.0 Received: by 10.216.217.228 with SMTP id i78mr11682596wep.126.1338836366198; Mon, 04 Jun 2012 11:59:26 -0700 (PDT) Received: by 10.216.238.139 with HTTP; Mon, 4 Jun 2012 11:59:26 -0700 (PDT) Date: Mon, 4 Jun 2012 20:59:26 +0200 Message-ID: From: Diego Olivier Fernandez Pons To: caml-list Content-Type: text/plain; charset=ISO-8859-1 Subject: [Caml-list] Puzzled by Scanf.Scanning.in_channel Caml-List, When I try to use Scanf.fscanf with an input channel created with Scanf.Scanning.from_string the type checker complains let s = Scanf.Scanning.from_string "3" in Scanf.fscanf s "%i" (fun x -> x);; Characters 55-56: Error: This expression has type Scanf.Scanning.in_channel but an expression was expected of type in_channel Which confuses me as from the manual I understood this should have worked. val from_string : string -> in_channel Scanning.from_string s returns a formatted input channel which reads from the given string. Reading starts from the first character in the string. The end-of-input condition is set when the end of the string is reached. Could anyone explain how is the proper way to generate a input channel from a string ? Its for testing a program that will use stdin in production. Diego Olivier