• Silly question

    From Sean Dennis@1:18/200 to All on Saturday, April 30, 2005 14:48:20
    Hi, everyone.

    Silly question, but I'm working on a new door and it's been a long while since I've picked up the compiler. I'm using Borland Pascal and I keep getting an "Error 39: Ordinal expression expected" for this line of code:

    Case UTemp Of (UTemp is a string)

    Is there something that I forgot about the Case statement? :>

    Later,
    Sean

    // sysop@outpostbbs.net | http://outpostbbs.net | ICQ: 19965647

    --- Telegard/2 v3.09.g2-sp4/mL
    * Origin: Outpost BBS - Kennesaw, GA - outpostbbs.net (1:18/200)
  • From Björn Felten@2:203/2 to Sean Dennis on Monday, May 02, 2005 03:47:48
    Is there something that I forgot about the Case statement? :>

    Rather about ordinal expressions. A string can never be an OE. Try Char, Byte or something more ordinal.

    ---
    * Origin: news://felten.yi.org (2:203/2)
  • From Roelof Beverdam@2:280/5218 to Sean Dennis on Sunday, May 01, 2005 10:45:47
    Hi Sean,

    getting an "Error 39: Ordinal expression expected" for this line of code:

    Case UTemp Of (UTemp is a string)

    Is there something that I forgot about the Case statement? :>

    A string is not an ordinal value, it is a structured value. Depending on the contents of the string, you might consider

    Case UTemp[1] Of

    or rewrite your code to calculate some numeric value from your string and use that value in the Case ... Of.

    Only modern compilers (like Delphi) accept strings for case selectors.

    Cheers,
    Roelof Beverdam

    --- Dutchie V3.10.11
    * Origin: The Beaver's Nest (2:280/5218)
  • From Sean Dennis@1:18/200 to Björn Felten on Sunday, May 01, 2005 22:23:38
    *** Quoting Björn Felten from a message to Sean Dennis ***

    Rather about ordinal expressions. A string can never be an OE. Try Char, Byte or something more ordinal.

    Embarrasingly enough, I discovered that out after I wrote the message by looking it up online. ;) Turns out that Case..Of can only use ordinal expressions. A little code wrangling and all works out. However, now I'm having another problem.

    I'm writing a little BBS list door for my system. Nothing too hard. But I'm getting a type mismatch error. Let me explain a little more:

    Here's the type and how I declare it:

    Type
    BBS = Record
    BoardName : String[70];
    SysopName : String[40];
    Software : String[30];
    Phone : String[20];
    Telnet : String[30];
    Hours : String[15];
    URL : String[68];
    Networks : String[68];
    Comments : String[68];
    End;

    Var
    BBSFile : File of BBS;
    BBSR : BBS;

    (BBSR is short for BBSRecord)

    Now, when I first tried to use this:

    Inpt(Temp, 40, 14, 9);
    BBSR.SysopName := Temp;

    (Inpt is a special routine for input in the doorkit I'm using. The Temp variable is a string.)

    When I did:

    Inpt(BBSR.SysopName, 40, 14, 9);

    I got "Type mismatch" errors. Okay, so I worked around it using the above routine.

    When I tried:

    Write(BBSFile, BBSR.BoardName);

    I got the error again.

    Forgive my silly questions as I haven't touched the compiler in about a year really on a new project, but why am I getting those errors when that particular
    variable is declared as a string, yet I can't write it to a file of the same type?

    I have problems grasping simple solutions now due to a variety of causes, but I'm just not understanding why it's not working. I'm sure it's something stupid that I'm not seeing.

    Any help is appreciated.

    Thanks,
    Sean

    // sysop@outpostbbs.net | http://outpostbbs.net | ICQ: 19965647

    --- Telegard/2 v3.09.g2-sp4/mL
    * Origin: Outpost BBS - Kennesaw, GA - outpostbbs.net (1:18/200)
  • From Björn Felten@2:203/2 to Sean Dennis on Monday, May 02, 2005 09:53:25
    Inpt(BBSR.SysopName, 40, 14, 9);

    You obviously declared the first param for Inpt as 'var S:string'. That means that you cannot pass it a string[40]. And since I guess you are using the
    Inpt procedure for universal input, with different string lengths, your work about is probably the best way to do it.

    Write(BBSFile, BBSR.BoardName);

    Since you have declared BBSFile to be a file of BBS you can only write variables of type BBS to it. BBSR is of that type, BBSR.BoardName is not, it's a string[70].

    Forgive my silly questions

    There are no silly questions, only silly answers! 8-)

    Oh, and don't forget to use 'with BBSR do...' rather than writing 'BBSR.' in
    front of every record part, it makes it so much easier to read the program later on, IMHO.

    ---
    * Origin: news://felten.yi.org (2:203/2)
  • From Sean Dennis@1:18/200 to Björn Felten on Monday, May 02, 2005 12:04:46
    *** Quoting Björn Felten from a message to Sean Dennis ***

    That means that you cannot pass it a string[40]. And since I guess

    Ah! *the light turns on*

    Okay, I was trying to be good and save room in memory. I can go fix that then.

    Thanks for the advice! Wow, I feel much happier now. ;) I spent about two hours last night working on the display, etc. I'm taking my time with this door, even though it's simple, it takes a massive effort on my part to program because it's hard for me to grasp things initially (but once I get them, it's a
    lot easier).

    Oh, and don't forget to use 'with BBSR do...' rather than writing 'BBSR.' in front of every record part, it makes it so much easier to
    read the program lateron, IMHO.

    What exactly do you mean? I'm not quite sure-in writing the file or what? I don't know a lot of the shortcuts in Pascal, but I'm hoping that my skills will
    improve enough for me to figure things out. ;) I just started using included files (for my help files and such-makes the main source code much easier to read).

    Thanks again for your help. Much appreciated!

    Later,
    Sean

    // sysop@outpostbbs.net | http://outpostbbs.net | ICQ: 19965647

    --- Telegard/2 v3.09.g2-sp4/mL
    * Origin: Outpost BBS - Kennesaw, GA - outpostbbs.net (1:18/200)
  • From Björn Felten@2:203/2 to Sean Dennis on Monday, May 02, 2005 18:32:05
    What exactly do you mean?

    Rather than writing something like this:

    BBSR.BoardName:=...
    ... some code...
    BBSR.SysopName:=...
    ... some code...
    BBSR.Software:=...
    ... some code...
    BBSR.Phone:=...
    ... some code...
    BBSR.Telnet:=...
    ... some code...

    ...you do it like this:

    with BBSR do begin
    BoardName:=...
    ... some code...
    SysopName:=...
    ... some code...
    Software:=...
    ... some code...
    Phone:=...
    ... some code...
    Telnet:=...
    ... some code...
    end;

    Thanks again for your help. Much appreciated!

    No problem, just keep 'em coming! :)

    ---
    * Origin: news://felten.yi.org (2:203/2)
  • From Sean Dennis@1:18/200 to Björn Felten on Monday, May 02, 2005 16:30:42
    *** Quoting Björn Felten from a message to Sean Dennis ***

    No problem, just keep 'em coming! :)

    I have a good one, but it might be kinda long to post in here. Basically, I'm having problems with the search "engine" I put into the program. I can now add
    and write to the file, thankfully. Let me get a few other things done and then
    we can work on the search stuff. That's really not that much for me to fix-it's just a stupid error on my part somewhere.

    Thankfully, it DOES work. I'm suprised at how much I actually remember.

    Later,
    Sean

    // sysop@outpostbbs.net | http://outpostbbs.net | ICQ: 19965647

    --- Telegard/2 v3.09.g2-sp4/mL
    * Origin: Outpost BBS - Kennesaw, GA - outpostbbs.net (1:18/200)
  • From Scott Adams@1:112/91 to Sean Dennis on Wednesday, May 04, 2005 00:04:09
    Quoting Sean Dennis to All <=-

    Silly question, but I'm working on a new door and it's been a long
    while since I've picked up the compiler. I'm using Borland Pascal and
    I keep getting an "Error 39: Ordinal expression expected" for this
    line of code:
    Case UTemp Of (UTemp is a string)

    Is there something that I forgot about the Case statement? :>

    Can't use string. But you could convert the string
    into a number value if needed or its ascii value.
    Depending on what your need is.



    ... Did I ever tell you that story? - Londo
    --- Fringe BBS
    * Origin: EWOG II - The Fringe - 904-733-1721 (1:112/91)
  • From Scott Adams@1:112/91 to Sean Dennis on Wednesday, May 04, 2005 00:09:21
    Quoting Sean Dennis to Björn Felten <=-


    That means that you cannot pass it a string[40]. And since I guess

    Ah! *the light turns on*

    Okay, I was trying to be good and save room in memory. I can go fix
    that then.
    Thanks for the advice! Wow, I feel much happier now. ;) I spent
    about two hours last night working on the display, etc. I'm taking my time with this door, even though it's simple, it takes a massive
    effort on my part to program because it's hard for me to grasp things initially (but once I get them, it's a lot easier).

    If you want to save memory use pointers :)

    Oh, and don't forget to use 'with BBSR do...' rather than writing 'BBSR.' in front of every record part, it makes it so much easier to
    read the program lateron, IMHO.

    What exactly do you mean? I'm not quite sure-in writing the file or
    what? I don't know a lot of the shortcuts in Pascal, but I'm hoping
    that my skills will improve enough for me to figure things out. ;) I
    just started using included files (for my help files and such-makes
    the main source code much easier to read).
    Thanks again for your help. Much appreciated!

    You ever read my pascal tutorial files I did in Advnet
    a few times over the years in AdventureNet programming
    echo?




    ... Thats a very Russian attitude. I approve. - Lt. Cmdr. Ivanova
    --- Fringe BBS
    * Origin: EWOG II - The Fringe - 904-733-1721 (1:112/91)
  • From Scott Adams@1:112/91 to Sean Dennis on Wednesday, May 04, 2005 00:11:05
    Quoting Sean Dennis to Björn Felten <=-

    No problem, just keep 'em coming! :)

    I have a good one, but it might be kinda long to post in here.
    Basically, I'm having problems with the search "engine" I put into the program. I can now add and write to the file, thankfully. Let me get
    a few other things done and then we can work on the search stuff.
    That's really not that much for me to fix-it's just a stupid error on
    my part somewhere.
    Thankfully, it DOES work. I'm suprised at how much I actually

    The secret of searching for things is the Pos command.
    If you need help beyond that holler.



    ... He's more human than the human contingent on the station. (re: Londo)
    --- Fringe BBS
    * Origin: EWOG II - The Fringe - 904-733-1721 (1:112/91)
  • From Robert Wolfe@1:2613/4307 to Sean Dennis on Saturday, May 07, 2005 19:47:18

    I have a good one, but it might be kinda long to post in here. Basically, I'm >having problems with the search "engine" I put into the program. I can now ad >and write to the file, thankfully. Let me get a few other things done and the
    we can work on the search stuff. That's really not that much for me to fix-it's just a stupid error on my part somewhere.
    Thankfully, it DOES work. I'm suprised at how much I actually remember.

    Well you can always posting using the web interface here :) Also are you storing the data in a sequential or random data file?

    --- BBBS/2 v4.00 MP
    * Origin: BuffalOS/2 * Buffalo, NY * bufonline.dyndns.org (1:2613/4307)
  • From Sean Dennis@1:18/200 to Robert Wolfe on Sunday, May 08, 2005 10:41:35
    Hello, Robert.

    On 07 May 05 at 18:47, Robert Wolfe wrote to Sean Dennis:

    Well you can always posting using the web interface here :) Also are
    you storing the data in a sequential or random data file?

    It's not the posting, it's the length. It could've broken some mail processors
    ... the problem's been solved, actually.

    Later,
    Sean

    // hausmaus@darktech.org | http://midnightshour.net | ICQ: 19965647

    --- GoldED+/EMX 1.1.5-21020
    * Origin: Outpost BBS - Kennesaw, GA - outpostbbs.net (1:18/200)