tags:

views:

100

answers:

1

Hi,

I'm trying to compile this program under Windows (it's a program which turns bootable code in floppies. I got the source from here: http://www.acm.uiuc.edu/sigops/roll_your_own/1.bootstrap.html).

First I got the problem that it didn't read the INI file. That is solved now. Now I get a segfault on the following rule:

while(data < end) 

I added output to the app, so it should be clear where the executing stops: no "."'s are printed out. I'm on Win64, with the Cygwin toolchain.

Thanks!

Yvan

+2  A: 

A mistake is:

size = (int *)lSize;

Better:

*size = lSize;

and the function as:

void *loadfile(char *file, long *size)
...

and in calling context eg:

long size=0;
char *buffer = loadfile("blah.txt",&size);
if( buffer )
{
  printf("\nstrlen = %lu, fsize = &ld", strlen(buffer), size );
}