www.digitalmars.com         C & C++   DMDScript  

D - using functions defined in C header files

reply llee <llee_member pathlink.com> writes:
I wrote the following application, and it uses the function _bios_disk that is
defined in the bios.h file. I imported the file, but I get the following error
message during compilation: 

"
diskread02.obj(diskread02)
Error 42: Symbol Undefined _bios_disk

--- errorlevel 1
"
This has been a repeating problem for me so ANY help would be appreciated.

#include <bios.h>
#include <stdio.h>
#include <stdlib.h>

void main ()
{
// declarations:
int			i;
int			result;
static char		dbuf[512];

struct diskinfo_t 
{
int drive;		// drive number for c:
int head;
int track;
int sector;
int nsectors;
void* buffer;
};
struct diskinfo_t diskinfo;
diskinfo.drive 	= 2;
diskinfo.head	= 0;
diskinfo.track	= 0;
diskinfo.sector	= 1;
diskinfo.nsectors	= 1;
diskinfo.buffer	= dbuf;

// operations:
printf ("attempting to read from drive c:\n");

result = _bios_disk (2, &diskinfo);

if ((result & 0xff00) == 0)
{	printf ("disk read from c: successful.\n");	}
else 
{	printf ("disk read operation failed. \n");	}

for (i = 0; i <= 512; i ++)
{	printf ("0x%02x ", dbuf[i]);	}

}
Apr 27 2006
parent Derek Parnell <derek psych.ward> writes:
On Fri, 28 Apr 2006 03:31:47 +0000 (UTC), llee wrote:

 I wrote the following application, and it uses the function _bios_disk that is
 defined in the bios.h file. I imported the file, but I get the following error
 message during compilation: 
 
 "
 diskread02.obj(diskread02)
 Error 42: Symbol Undefined _bios_disk
 
 --- errorlevel 1
 "
 This has been a repeating problem for me so ANY help would be appreciated.
 
 #include <bios.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 void main ()
 {
 // declarations:
 int			i;
 int			result;
 static char		dbuf[512];
 
 struct diskinfo_t 
 {
 int drive;		// drive number for c:
 int head;
 int track;
 int sector;
 int nsectors;
 void* buffer;
 };
 struct diskinfo_t diskinfo;
 diskinfo.drive 	= 2;
 diskinfo.head	= 0;
 diskinfo.track	= 0;
 diskinfo.sector	= 1;
 diskinfo.nsectors	= 1;
 diskinfo.buffer	= dbuf;
 
 // operations:
 printf ("attempting to read from drive c:\n");
 
 result = _bios_disk (2, &diskinfo);
 
 if ((result & 0xff00) == 0)
 {	printf ("disk read from c: successful.\n");	}
 else 
 {	printf ("disk read operation failed. \n");	}
 
 for (i = 0; i <= 512; i ++)
 {	printf ("0x%02x ", dbuf[i]);	}
 
 }
This is the "D" newsgroup and not used for "C" problems. Maybe you should repost this to the C++ newsgroup. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 28/04/2006 1:45:00 PM
Apr 27 2006