Welcome, Guest. Please login or register.

Author Topic: Retrieving FileSize in bytes  (Read 2984 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline PiR

  • Full Member
  • ***
  • Join Date: Apr 2003
  • Posts: 148
    • Show all replies
Re: Retrieving FileSize in bytes
« on: January 12, 2004, 06:53:31 PM »
Hi

I used the stuff, but in bad way, I shouldn't even speak about... But it worked. :-)
Well, as DOS was written in BCPL (at least the virst versions of it), all the used pointers had to be LONG aligned.

On the other hand we know that all the compilers do at least SHORT align. So this is what I did:

struct {
 short dummy;
 struct FileInfoBlock fib;
} buffer;
struct FileInfoBlock *fib = (struct FileInfoBlock *)( ( (long) &buffer.fib )&~3L );

if (Examine(, fib)) fib_Size>;


Now you may kill me.  ;-)
But at least you can try if it crashes.

Good luck
 

Offline PiR

  • Full Member
  • ***
  • Join Date: Apr 2003
  • Posts: 148
    • Show all replies
Re: Retrieving FileSize in bytes
« Reply #1 on: January 13, 2004, 01:06:29 PM »
Quote
(struct FileInfoBlock *)fib = AllocDosObject(DOS_FIB, TAG_END)


Yep, you have it on the wrong side.
You mean:
fib = (struct FileInfoBlock *)AllocDosObject(DOS_FIB, TAG_END)