View Full Version : coursework, help please.
04-12-2006, 10:23 AM
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:
readfile := false;
readfile := true;
memo1summary.lines := Abooking.eventtitle;
memo1summary.lines := Abooking.name;
memo1summary.lines := Abooking.audience;
memo1summary.lines := Abooking.event;
memo1summary.lines := Abooking.time;
//end of file
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.
04-12-2006, 10:27 AM
you want someone to do your homework for you online?!
04-12-2006, 10:37 AM
What language is that? I can't seem to recognize it as any of the ones I've seen at all.
04-12-2006, 10:43 AM
Been a long time, but looks like Pascal?
04-12-2006, 10:50 AM
well I know in C++ you can do
while(getline << eventitle)// isnt it great that streams can return a bool
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
04-12-2006, 10:52 AM
Yes i do want you to do my homewok for me and i thought you guy were surposed to be nerds. Im using delphi.
04-12-2006, 11:17 AM
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:
04-12-2006, 11:40 AM
Been a long time, but looks like Pascal?That's Delphi, (formerly Object Pascal). (Some of us were "Delphi language nerds" in a former life....)
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.
vBulletin® v3.6.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.