Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

reading textfiles

Posted on 2003-11-06
3
Medium Priority
?
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 49

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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

If you’re involved with your company’s wide area network (WAN), you’ve probably heard about SD-WANs. They’re the “boy wonder” of networking, ostensibly allowing companies to replace expensive MPLS lines with low-cost Internet access. But, are they …
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

670 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