|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
coursework, help please.
im uising windows programing language and basically in need to make a booking file print in a human friendly kind of way. Here is the code i am using:
try readfile := false; read(bookingFile, Abooking); readfile := true; while readfile do memo1summary.lines[1] := Abooking.eventtitle; memo1summary.lines[2] := Abooking.name; memo1summary.lines[3] := Abooking.audience; memo1summary.lines[4] := Abooking.event; memo1summary.lines[5] := Abooking.time; until //end of file end; all i need is something that will make it recall each booking until the end of the file. I also need to change tdate into a string. Any help would be much appreciated. thanks. |
|
#2
|
||||
|
||||
|
Re: coursework, help please.
you want someone to do your homework for you online?!
|
|
#3
|
|||||
|
|||||
|
Re: coursework, help please.
What language is that? I can't seem to recognize it as any of the ones I've seen at all.
|
|
#4
|
|||
|
|||
|
Re: coursework, help please.
Been a long time, but looks like Pascal?
|
|
#5
|
||||
|
||||
|
Re: coursework, help please.
well I know in C++ you can do
while(getline << eventitle)// isnt it great that streams can return a bool { //other stuff. } I have know idea how to do a End of file test for . . what ever language your useing. but if I were you I would read the documentation on the read(), and readfile functions. edit ok Ive read up on this . . if the readfile function has an error(like the file has no more info in it) it will return a 0 so I would suguest that you use that for your else(its not a fancy way of doing it but it will get it working) as for changeing the date to a string. . . thats something that you can figure out Last edited by Stuart : 12-04-2006 at 11:59. |
|
#6
|
|||
|
|||
|
Re: coursework, help please.
Yes i do want you to do my homewok for me and i thought you guy were surposed to be nerds. Im using delphi.
|
|
#7
|
||||
|
||||
|
Re: coursework, help please.
we are nerds. Some of us have PHDs in nerdology
but you are on the wrong forum. We are robot nerds, not Delphi language nerds: http://www.chiefdelphi.com/forums/sh...ad.php?t=29944 Last edited by KenWittlief : 12-04-2006 at 12:39. |
|
#8
|
||||
|
||||
|
Re: coursework, help please.
Quote:
Alright, what's going on here? You want to read from a textfile, and pass the output to a memo box? First of all, if you're using the try structure, you're probably familiar with exception handling. Can I assume that you want to check the status of the file reading operation, and throw an exception on an error?* And further, I'll assume that you're using the built-in textfile routines (check the Delphi help for the code example for AssignFile), and not the binary file routines. To read until the end of file, try using the EOF function to determine whether you've reached the end of the file (check the documentation; there's surely an example that you can study). Don't call your variable "readfile". There's a built-in function with that name already. (It won't interfere with your program, unless you use ReadFile, but it's bad style.) To reiterate, you're in the wrong place for Delphi help; didn't you see the message when you posted that tells you that this forum isn't normally used for the Delphi language? *This is ugly, from a UI point of view. Try to make a "friendly" error message, rather than let the user see a Windows exception. To do this, you could use try with the except block. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|