Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
995 connectés 

  FORUM HardWare.fr
  Programmation
  Ada

  [Ada]fichier texte

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Ada]fichier texte

n°132569
sinse
Posté le 30-04-2002 à 10:19:32  profilanswer
 

Salut à tous,
J'aimerais savoir comment on fait pour aller chercher des informations dans un fichier texte.  
merci d'avance
sinsé

mood
Publicité
Posté le 30-04-2002 à 10:19:32  profilanswer
 

n°134461
Procat
L'eternel insatisfait !
Posté le 04-05-2002 à 12:25:20  profilanswer
 

-- Séquence de caractères (lue dans un fichier) ("Machine-Caractère", modele 1)
 
with Ada.Text_Io;  
 
package body f_acces_sequentiel_m1 is  
 
use Ada.Text_Io;
     
    Texte: File_Type;            -- Texte donné
    CC: Character;               -- Caractère Courant  
    Fin: Boolean;                -- indicateur de fin
    Active: Boolean := false;    -- Statut indiquant si la séquance est active ou non
    StdIn: Boolean := true;      -- Indique si le fichier utilisé est le stdIn ou pas
     
    procedure Demarrer(nom_fichier : in string := "" ) is
    begin  
        if nom_fichier /= "" then
   StdIn := false;
          Open(Texte, In_File, nom_fichier);
   Set_Input(Texte);
 end if;
        Fin := false;    
 Active := true;
        Avancer;
    end Demarrer;
 
--  ou bien   procedure Demarrer is
--            begin  
--               Put("Nom du fichier : " );
--               Get_Line(Nom, Long);
--               Open(Texte, In_File, Nom(1..Long));  
--               Fin := false;
--               Active := true;
--               Avancer;
--            end Démarrer;
 
    procedure Arreter is
    begin  
        if not Active then raise SEQUENCE_INACTIVE; end if;
        if not StdIn then
           Close(Texte);
        end if;
 Active := false;
    end Arreter;
 
    procedure Avancer is
    begin
        if not Active then raise SEQUENCE_INACTIVE; end if;
        if End_Of_File then
            Fin := true;
        elsif End_Of_Line then
            Skip_Line;
            CC := ASCII.LF;
        else
            Get(CC);  
        end if;        
    end Avancer;  
     
    function Courant return Character is
    begin
        if not Active then raise SEQUENCE_INACTIVE; end if;
        return CC;
    end Courant;
     
    function FdS return Boolean is
    begin
        if not Active then raise SEQUENCE_INACTIVE; end if;
        return Fin;
    end FdS;
     
end f_acces_sequentiel_m1;


---------------
[:procat]

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Ada

  [Ada]fichier texte

 

Sujets relatifs
[VC++] problème avec projet contenant plusieurs fichier .C[java] comment obtenir le propriétaire d'un fichier sous nt4
[C / C++] un client FTP activeX pour uploader un fichier en ASYNC ?[JAVA] Affichage texte
[C++] chercher un sub-chunk dans un fichier AVI ?[javascript] Souligner une partie d'un texte mise en surbrillance
ecriture dans un fichier en vb ![JS+PHP]mailto avec un texte dans le message de plus d'une ligne
[VBA] Fusionner le texte de cellules contigues en VBA Excel (Urgent)[C++Builder] Effacement de texte dans un canvas
Plus de sujets relatifs à : [Ada]fichier texte


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR