www.digitalmars.com         C & C++   DMDScript  

c++.dos - 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 28 2006
parent Cesar Rabak <crabak acm.org> writes:
llee escreveu:
 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

Can you please post the command line you have used to compile the program? -- Cesar Rabak
Apr 28 2006