reading files help

Discussion in 'VHDL' started by Scott_uoa, Nov 16, 2006.

  1. Scott_uoa

    Scott_uoa

    Joined:
    Nov 16, 2006
    Messages:
    1
    hello,

    i have written code to read in a file, being pgm format, it copies the first 4 lines as they just identifies the file properties, and then i want it to read integer values one by one and output to a file. the expected result should be same as the input file. can anyone tell me whats wrong with my code? any other suggestions how to go about it? and finally i have also been asked to create a memory array to store the information, is there any links or do you know howi would do this?

    thank you in advance,

    scott

    library IEEE;
    use IEEE.std_logic_1164.all;
    use IEEE.std_logic_textio.all;
    use STD.textio.all;

    entity file_io is
    end file_io;

    architecture sim of file_io is
    file infile : text open READ_MODE is "input.txt";
    file outfile : text open WRITE_MODE is "output.txt";
    begin
    fcopy : process
    variable l: line;
    variable number: integer;
    variable h: line;
    begin -- fcopy process
    for i in 1 to 4 loop
    readline(infile,l);
    writeline(outfile,l);
    end loop;
    while not endfile(infile) loop
    readline(infile,l);
    read(l,number);
    write(h,number);
    writeline(outfile,h);
    end loop;
    file_close(infile);
    file_close(outfile);
    wait;
    end process fcopy;
    end sim;
     
    Scott_uoa, Nov 16, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve B.
    Replies:
    0
    Views:
    643
    Steve B.
    Feb 26, 2004
  2. rob hadow

    JAR files reading list files

    rob hadow, May 21, 2004, in forum: Java
    Replies:
    4
    Views:
    4,794
    rob hadow
    May 21, 2004
  3. blabla120@gmx.net
    Replies:
    0
    Views:
    799
    blabla120@gmx.net
    Sep 15, 2006
  4. jeff
    Replies:
    5
    Views:
    353
    John Machin
    Feb 6, 2007
  5. Narendra Sisodiya

    Reading files inside zip files from Javascript

    Narendra Sisodiya, Dec 7, 2009, in forum: Javascript
    Replies:
    7
    Views:
    288
    Michael Haufe (\TNO\)
    Dec 8, 2009
Loading...

Share This Page