Hi, I'm currently working on a turbo pascal program. I'm creating a game, and were wondering if there was a way to set a timer. This would be done so the user has a limited time to complete the task. I'm only a beginner, so much help is appreciated.

I was wondering since you help out the other person so helpfully that maybe you could help me with my problem to.

mine is a bit more comlicated....

it starts with a new file foremat -- .mal (short for .mail)

the file format goes like this ...

File signature (12h 34h)
To: Feild (varying length)
end of feild mark (00h)
From: feild(varying length)
end of feild marker(00h)
ETC...


BUT ... i cant get Turbo to recognize the control characters
I.E. characters not on your keyboard
12h is a control character for instance
so i can't even read the file signature!!!

I am using the Read procedure as such.....
var infile : text;
tmp : string;

Read(infile,tmp[1]);
Read(infile,tmp[2]);
if tmp <> #18#52 then .......etc

to feed a string into tmp character by character from Infile;
*Note1 im using EBCDIC format instead of ASCII
*Note2 #18#52 = 12h 34h because the # operator requires they be in decimal form

I've never done this before so there's probably a much easier way but... :o

You'll need to read the file one character at a time and parse it.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
    MyString: string;
    OutFile: Text;
    InFile: Text;
    CurrentChar: Char;
    FieldIndex: Integer;
    Heading: string;
begin
    MyString := Char(18) + Char(52) + 'John Doe' + Char(0) +
        'Tom Smith' + Char(0) + 'This is subject line.' +
        Char(0) + 'This is in the message body.' + Char(0);

    AssignFile(OutFile, 'D:\test_file.txt');
    Rewrite(OutFile);
    Write(OutFile, MyString);
    Close(OutFile);

    AssignFile(InFile, 'D:\test_file.txt');
    Reset(InFile);
    MyString := '';
    FieldIndex := 0;
    while not Eof(InFile) do
    begin
        Read(InFile, CurrentChar);
        if not ((CurrentChar = Char(18)) or (CurrentChar = Char(52))) then
        begin
            if CurrentChar <> Char(0) then
            begin
                MyString := MyString + CurrentChar;
            end
            else
            begin
                FieldIndex := FieldIndex + 1;
                case FieldIndex of
                    1: Heading := 'TO: ';
                    2: Heading := 'FROM: ';
                    3: Heading := 'SUBJECT: ';
                    4: Heading := 'MESSAGE: ';
                else
                    Heading := '';
                end;
                WriteLn(Heading + MyString);
                MyString := '';
            end;
        end;
    end;
    Close(InFile);
end.

Thank you for your help...

i forgot about the CHR() function and was useing the # operator wrong

some times a get a little confused by my own script.

ill try working something like that into my script

and if you want when i finish ill let you have a workng copy to see
how you like it

it mails digital mail inside your computer(across users)

kinda like Winpopup but you dont have to have it open all the time

Thanks always ~Vitus

Hello Agian everyone...

I keep running into a problem when moving/deleteing files in folders

I use a loop and findnext to get file names and then erase them

until i come upon certin files where i get Runtime Error 5: File Access Denied.

I dont mind it they can stay where they are. But they HALT my program!

so i need a way to catch that error and skip that name so my program doesnt stop.

Thanks in advance
~Vitus

P.S. sorry for the horrible formatting of this reply Im in a rush at the moment

Sorry man, I assumed this being a Pascal Thread everyone would think im useing Pascal.

But for future reference Im running Turbo Pascal 5.5

and if anyones got any tips for error catching in Pascal please inform me

(to the best of my knowledge the try keyword was introduced in delphi 2.0)

Thanks Anyway
~ Vitus

hi all
im hani from palestine
i need to help
i need calender programm in pascal

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.