James,

The header is correct - it defines a memory structure in QDOS, not a
structure designed for use with C.   As such the definition is fixed and
cannot be changed.   You will find that under QDOS all strings are preceded
by a 2-byte field that defines the length of the following string, and
strings are not zero-terminated.   When programming in C one should always
therefore take account of this, and make sure that you use the length
limiting variants of copies and moves as you cannot assume a zero
termination to such strings.

It can be advantageous to look at the .hdr versions of the header files
supplied on one of the source disks.    These include comments which can
make the files much easier to peruse.   You can also rename them and put
them in place of the supplied .h files which have been processed to remove
all comments and formatting to reduce their size for those using floppy
based systems.  Those using hard disk based systems are better off using the
commented versions

Dave
.
----- Original Message ----- 
From: "James Hunkins" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 04, 2006 3:18 PM
Subject: [ql-users] bug in qlib_h C68 support file


> Guys,
>
> I think that I found a bug in the qlib_h include file used by C68.
> Here are the details:
>
> In the 'qdirect' structure, the member 'd_name' is defined as:
> char d_name[36];
>
> This works as long as the directory/file name is 35 or fewer
> characters and holds a properly terminated C string (terminates with
> a '0').  However, if the total name length is actually 36 characters,
> then there is no termination.  As far as I can tell the structure
> does properly hold everything and isn't corrupt, just no termination
> in that one case.
>
> This might explain why in a few problems with long file names, I see
> handling problems but not in others (compiled in C68 versus assembly
> or compiled SBASIC for example?).
>
> If I am correct this structure should define it as:
>
> char d_name[37];
>
> to allow room for the termination character of a C string.
>
> Jim
>
> _______________________________________________
> QL-Users Mailing List
> http://www.q-v-d.demon.co.uk/smsqe.htm

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to