Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

reading textfiles

Posted on 2003-11-06
3
Medium Priority
?
221 Views
Last Modified: 2010-04-16
When I run the program it has to read from a file called INVENTOR, so when the program exexutes and comes to the part where it has to read from the file it  displays
Input file `Inventor':
when i put inventor then press enter i get this message
./program: cannot open file `inventor' for reading (No such file or directory) (error #442 at 11c33)

i want it so the program just reads the file and not prompts me this (Input file `Inventor':) line
how do i fix this?

thanks
0
Comment
Question by:vyhoang
3 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 9698753
This seems to be related to this question
http://www.experts-exchange.com/Programming/Programming_Languages/Pascal/Q_20790139.html


This sounds a lot like homework. It is agains EE policy for members to do homework OR for members to request solutions to homework. Has something to do the "academic honesty".

That said, what do you know how to do inPascal?  Show us your code so far and we would be happy to answer your specific questions.

Post the code you have written that is giving the trouble and we can try to help.

mlmcc

0
 

Author Comment

by:vyhoang
ID: 9698778
Procedure LoadFile;
BEGIN
   reset(INVENTOR);
   Count := 0;
   Sum := 0;
   WHILE NOT eof (INVENTOR) DO
   BEGIN
      readln(INVENTOR, id, instock, min, price, name);
      Count := Count + 1;
      Sum := Sum + price;
   end;
   writeln('There are ', Count, 'items in stock');
   writeln('The total retail is ', Sum);
end; { LoadFile }

I'm sorry i didn't know we had to post the code
This is a section of the code where the file is being loaded, the same problem applies, could you possible help me fix it
0
 
LVL 50

Accepted Solution

by:
dbrunton earned 150 total points
ID: 9699681
Looks like you're missing the Assign procedure.  Probably something like this

var
 f: text;

Assign(f, 'INVENTOR');
Reset(f);

All references to the file should use f and not INVENTOR.  You may even need to specify the path to the file such as

Assign(f, 'A:\INVENTOR');

depending on your computer system.

As mlmcc says if you are having problems post code.  And we don't do homework but can help you solve your problems.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know there are services out there that can turn an Instagram feed into an RSS feed? I found some interesting exclusive Instagram content which I wanted to follow without signing up for yet another social media account. RSS to the rescue!
In this article, the configuration steps in Zabbix to monitor devices via SNMP will be discussed with some real examples on Cisco Router/Switch, Catalyst Switch, NAS Synology device.
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question