Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > reading files help

Reply
Thread Tools

reading files help

 
 
Scott_uoa Scott_uoa is offline
Junior Member
Join Date: Nov 2006
Posts: 1
 
      11-16-2006
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;
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading files inside zip files from Javascript Narendra Sisodiya Javascript 7 12-08-2009 02:15 AM
UnauthorizedAccessException when reading XML files (no problem when reading other file-types) blabla120@gmx.net ASP .Net 0 09-15-2006 02:08 PM
reading the DB vs. reading a text file...performance preference? Darrel ASP .Net 3 11-11-2004 02:27 PM
Help! Files, Files, and more Files ... Everywhere JeffS Digital Photography 22 09-19-2004 01:47 AM
JAR files reading list files rob hadow Java 4 05-21-2004 04:41 PM



Advertisments