www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - using functions defined in C header files

↑ ↓ ← 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
↑ ↓ → 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