comp.lang.ada
 help / color / mirror / Atom feed
From: "Charles Fr. Rey" <charlesfr.rey@epfl.ch>
Subject: Re: Problème avec des get(fichier, integer)
Date: Thu, 10 Jan 2002 14:00:43 +0100
Date: 2002-01-10T14:00:43+01:00	[thread overview]
Message-ID: <3C3D907B.96C0B981@epfl.ch> (raw)
In-Reply-To: a0vili$oga$1@wanadoo.fr

In my opinion you'd better use the predefined date & time types ...

Y'a plein de fonctions et de types déjà prédéfinis et comme ça tu
utilises un format de date "standard". Tout dépends évidemment de
l'utilisation de ton programme, mais si le format de date n'est pas
imposé, t'as meilleur temps d'utiliser le format prédéfini.

Benoit F wrote:
> 
> I'm Fench so spry for my bad english. En français plus bas !
> I've the line "1/12/01:12" in a file, This line is a french date
> (day/month/year) with an hour
> 
> I've got the following type date :
>    subtype tjours is positive range 1..31;
>    subtype tmois is positive range 1..12;
>    subtype tans  is positive range 1..99;
> 
>   type TDate is record
>       J:tjours;
>       M:tmois;
>       A:tans;
>    end record;
> 
> I wrote this procedure
> 
>    procedure Get (F: in File_Type; D: out TDate) is
>    -- Entree d'une date a partir du fichier
>       Slash : Character;
>    begin
>       Get (F,D.J);
>       Get (F,Slash);
>       Get (F,D.M);
>       Get (F,Slash);
>       Get (F,D.A); <= here raise DATA_ERROR
>    end;
> 
> The error is because of the ':' charcater whose folow the date. If I replace
> the ':' by an other character, the procedure work !
> If sombody know the solution to make work my procedure !
> 
> ------------------------------------------------------------
> French traduction
> 
> mon fichier contient sur une ligne : "1/12/01:12"
> Elle correspond à une date suivie d'un nombre d'heure
> 
> j'ai un type date :
> 
>    subtype tjours is positive range 1..31;
>    subtype tmois is positive range 1..12;
>    subtype tans  is positive range 1..99;
> 
>   type TDate is record
>       J:tjours;
>       M:tmois;
>       A:tans;
>    end record;
> 
> j'ai crée la fonction
> 
>    procedure Get (F: in File_Type; D: out TDate) is
>    -- Entree d'une date a partir du fichier
>       Slash : Character;
>    begin
>       Get (F,D.J);
>       Get (F,Slash);
>       Get (F,D.M);
>       Get (F,Slash);
>       Get (F,D.A); <= plantage ici DATA_ERROR
>    end;
> 
> Le plantage est causé par le caractère ':' qui suit la date !
> Si je mais un autre caractère que ':' la procedure marche !
> 
> Si quelqu'un à une idée, je le remercie



  parent reply	other threads:[~2002-01-10 13:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a0vili$oga$1@wanadoo.fr>
2002-01-03  0:25 ` Probl�me avec des get(fichier, integer) Nick Roberts
2002-01-03  1:50   ` Matthew Graybosch
2002-01-07  9:43   ` Jean-Pierre Rosen
2002-01-03 15:47 ` Problème " M. A. Alves
2002-01-03 17:56   ` Probl�me " Nick Roberts
2002-01-04 11:46     ` Problème " M. A. Alves
2002-01-10 15:15     ` Probl�me " Robert A Duff
2002-01-10 23:46       ` Nick Roberts
2002-01-10 13:00 ` Charles Fr. Rey [this message]
2002-01-11  1:55   ` Problème " Jeffrey Carter
     [not found] <Pine.LNX.4.33.0201031536550.26565-100000@lagoa.niaad.liacc.up.pt>
2002-01-03 16:43 ` M. A. Alves
2002-01-03 21:11 ` Steven Deller
     [not found] <006801c1949b$39e20500$0301a8c6@STEVEN>
2002-01-04 11:40 ` M. A. Alves
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox