User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 455,976 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,797 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser: Programming Forums
Views: 2760 | Replies: 30
Reply
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How to get Dev-Pascal to use other files?

  #11  
Jan 31st, 2008
I just tested it with gpc also.

There is a logic error, btw. You should have:
  1. i := 1;
  2. while not eof( t ) do
  3. begin
  4. readln( t, s );
  5. writeln( 'line ', i, ': ', s );
  6. inc( i )
  7. end;
so as not to lose the last line of the file. (Unlike C and C++, Pascal is forward-capable when finding EOF.)

Hope this helps.
Reply With Quote  
Join Date: Nov 2007
Posts: 44
Reputation: Loyen is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Loyen Loyen is offline Offline
Light Poster

Re: How to get Dev-Pascal to use other files?

  #12  
Jan 31st, 2008
how?
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How to get Dev-Pascal to use other files?

  #13  
Jan 31st, 2008
If it is possible to read anything from the file, eof will not return true.
Therefore, while not eof, you can read and print a line of text.

Your previous code would read the last line of text, but not print it if eof was true. Hence, the last line of text was lost (read but not printed).


Wait, was that what your "how?" was for?
Reply With Quote  
Join Date: Nov 2007
Posts: 44
Reputation: Loyen is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Loyen Loyen is offline Offline
Light Poster

Re: How to get Dev-Pascal to use other files?

  #14  
Jan 31st, 2008
yeah, but I can see the text "untitled" in my program. but it's in the "commander" and is just "blinking" then it's gone.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How to get Dev-Pascal to use other files?

  #15  
Jan 31st, 2008
That means that your program couldn't find the file. Try running the program from the DOS command prompt.
Reply With Quote  
Join Date: Nov 2007
Posts: 44
Reputation: Loyen is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Loyen Loyen is offline Offline
Light Poster

Re: How to get Dev-Pascal to use other files?

  #16  
Feb 1st, 2008
And how do I do that?
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How to get Dev-Pascal to use other files?

  #17  
Feb 1st, 2008
Read me.

Hope this helps.
Reply With Quote  
Join Date: Nov 2007
Posts: 44
Reputation: Loyen is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Loyen Loyen is offline Offline
Light Poster

Re: How to get Dev-Pascal to use other files?

  #18  
Feb 5th, 2008
well it kinda worked.. change some things in the program and then it worked..
http://i29.tinypic.com/2wd3jus.jpg

Only repeating the first sentence.
how do I fix that?
Reply With Quote  
Join Date: Nov 2007
Posts: 44
Reputation: Loyen is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Loyen Loyen is offline Offline
Light Poster

Re: How to get Dev-Pascal to use other files?

  #19  
Feb 5th, 2008
well it kinda worked.. change some things in the program and then it worked..
http://i29.tinypic.com/2wd3jus.jpg

Only repeating the first sentence.
how do I fix that?
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How to get Dev-Pascal to use other files?

  #20  
Feb 5th, 2008
Don't forget to readln inside the loop.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Pascal and Delphi Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Pascal and Delphi Forum

All times are GMT -4. The time now is 9:19 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC