• Reading dat files

    From Andy Gorman@1:229/426.52 to All on Fri May 7 08:53:23 2021
    I'm currently writing a tool to read through the users.dat file (to get security levels and flags) using Free Pascal and am running into an issue where two things ae happening.

    First I'm noticing that user names that are less than 8 characters are getting some piece of the word "unknown" appended to them. For example, a username of "Trip" looks like "Tripown" when I pull it from the file (The BBS reads it properly).

    Second, when I loop through the file using the structure g00r00 has provided (thank you! :) ), it seems that the byte count gets thrown off by one right after the Birthday field. Which she is

    Any help would greatly appreciated.
    --- Mystic BBS v1.12 A47 2021/05/03 (Windows/64)
    * Origin: The Pot O'Gold - bbs.thepotogold.net:4888 (1:229/426.52)
  • From Alexander Grotewohl@1:120/616 to Andy Gorman on Fri May 7 13:20:29 2021
    On 07 May 2021, Andy Gorman said the following...

    First I'm noticing that user names that are less than 8 characters are getting s ome piece of the word "unknown" appended to them. For
    example, a username of "T rip" looks like "Tripown" when I pull it from the file (The BBS reads it properl y).

    are you correctly fetching the first byte of the username as the length?

    if you read through all the users using the same set of variables you can definitely end up with unexpected data in memory.

    --- Mystic BBS v1.12 A47 2021/04/20 (Windows/32)
    * Origin: cold fusion - cfbbs.net - grand rapids, mi (1:120/616)
  • From Andy Gorman@1:229/426.52 to Alexander Grotewohl on Fri May 7 12:14:56 2021
    On 07 May 2021, Alexander Grotewohl said the following...
    On 07 May 2021, Andy Gorman said the following...

    First I'm noticing that user names that are less than 8 characters ar getting s ome piece of the word "unknown" appended to them. For example, a username of "T rip" looks like "Tripown" when I pull it fr the file (The BBS reads it properl y).

    are you correctly fetching the first byte of the username as the length?

    if you read through all the users using the same set of variables you can definitely end up with unexpected data in memory.

    I am reading the file at position one and then having Pascal put the data into the type (the user record type). I can read through the file in C# just fine, but not with Pascal (I thought it'd be easier). I went down this road because of the real name and handle issue of having "own" appended to the values.
    --- Mystic BBS v1.12 A47 2021/05/03 (Windows/64)
    * Origin: The Pot O'Gold - bbs.thepotogold.net:4888 (1:229/426.52)
  • From g00r00@1:129/215 to Andy Gorman on Fri May 7 17:59:53 2021
    Second, when I loop through the file using the structure g00r00 has provided (th ank you! :) ), it seems that the byte count gets thrown off by one right after t he Birthday field. Which she is

    I don't know how to help you here without seeing code. But here is a very simple loop through the users using the barebones file I/O with no buffering or streaming, etc. If this doesnt work for you let me know it could be possible that the latest records aren't the ones that are included.

    Program ReadUsers;

    {$DEFINE WINDOWS}
    {$DEFINE 32BIT}

    {$I RECORDS.112}

    {$I-}

    Var
    F : File of RecUser;
    U : RecUser;
    Begin
    Assign (F, 'users.dat');
    Reset (F);

    If IoResult <> 0 Then
    Halt(1);

    While Not Eof(F) Do Begin
    Read (F, U);

    WriteLn ('Name: ' + U.Handle);
    End;

    Close (F);
    End.
    --- Mystic BBS v1.12 A47 2021/05/02 (Windows/64)
    * Origin: Sector 7 | Mystic WHQ (1:129/215)
  • From Andy Gorman@1:229/426.52 to g00r00 on Fri May 7 15:38:55 2021
    On 07 May 2021, g00r00 said the following...

    Second, when I loop through the file using the structure g00r00 has provided (th ank you! :) ), it seems that the byte count gets thrown by one right after t he Birthday field. Which she is

    I don't know how to help you here without seeing code. But here is a
    very simple loop through the users using the barebones file I/O with no buffering or streaming, etc. If this doesnt work for you let me know it could be possible that the latest records aren't the ones that are included.



    Well, that seems to work. Main differences was that I didn't include the records file, I just included the RecUser type and things that I thought were needed. Clearly, I missed some of the required stuff. Just because I want to, I am going to hunt down what I missed, because I think that's what's going on with my C# program.

    Thanks again!
    --- Mystic BBS v1.12 A47 2021/05/03 (Windows/64)
    * Origin: The Pot O'Gold - bbs.thepotogold.net:4888 (1:229/426.52)
  • From g00r00@1:129/215 to Andy Gorman on Fri May 7 20:12:36 2021
    Well, that seems to work. Main differences was that I didn't include
    the record s file, I just included the RecUser type and things that I thought were needed. Clearly, I missed some of the required stuff.

    Okay in that case you probably just needed a {$PACKRECORDS 1} in there at the top. You will see that in the records.112 so just copy that one line in there and that will probably fix up your original code too.
    --- Mystic BBS v1.12 A47 2021/05/02 (Windows/64)
    * Origin: Sector 7 | Mystic WHQ (1:129/215)
  • From Andy Gorman@1:229/426.52 to g00r00 on Sat May 8 10:05:14 2021
    On 07 May 2021, g00r00 said the following...

    Okay in that case you probably just needed a {$PACKRECORDS 1} in there
    at the top. You will see that in the records.112 so just copy that one line in there and that will probably fix up your original code too.

    Yeah, thats what it was. I've got it working the way I need to now. Thanks for the help!
    --- Mystic BBS v1.12 A47 2021/05/03 (Windows/64)
    * Origin: The Pot O'Gold - bbs.thepotogold.net:4888 (1:229/426.52)