www.digitalmars.com         C & C++   DMDScript  

c++ - using functions defined in C header files

reply newbie <newbie_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 28 2006
parent Jan Knepper <jan smartsoft.us> writes:
I am guessing that you are trying to compile the file for 95/NT.
Compile it and target DOS.



newbie 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]);	}
 
 }
 
 
 
-- ManiaC++ Jan Knepper But as for me and my household, we shall use Mozilla... www.mozilla.org
Apr 28 2006