I have a text file that I am splitting into two files. I am going through the input file line by line looking for CRLF, and with an if statement, performing an action when a CRLF is found. Here is a short snip-it of the input file with CRLFs. I am new to Ada, so if there is a better way to do this, please let me know
I want to be able to use ASCII.CR and ASCII.LF in an if that is possible.
I can get the single CRs that are on their own line with the code below, but I am having issues when trying to get the CRLF lines.
procedure readFrom is
My_File : FILE_TYPE;
File_Name : String := "input.txt";
CR : String := "" & ASCII.CR;
begin
open(My_File, In_File, File_Name);
create(out1, Out_File, "out1.txt";
create(out, Out_File, "out2.txt";
while not Ada.Text_IO.End_Of_File (My_File) loop
declare
line : String := Get_Line(My_File);
begin
if (line = CR) then
<*search the line and do stuff*>
end if;
end:
end loop:
Close(My_File);
end readFrom;