help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: writing on boot sector


From: Johannes Bauer
Subject: Re: writing on boot sector
Date: Sat, 04 Jul 2009 20:23:37 +0200
User-agent: Thunderbird 2.0.0.22 (X11/20090630)

zak100 schrieb:
> Hi,
> I have got a 'C' laguage to write on boot sector. When I excute it, nothing
> happens and the disk data remains the same. On the other hand assembly
> language version is wroking fine. Can somebody help me plz:

Check the return value of your functions for errors. It is likely the
open fails.

>         file_desc = open("./boot", O_RDONLY);

Check here.

>         read(file_desc, boot_buf, 510);

Check here.

>         close(file_desc);
>         
>         boot_buf[510] = 0x55;
>         boot_buf[511] = 0xaa;
> 
>         floppy_desc = open("/dev/fd0", O_RDWR);

Check here.

>         lseek(floppy_desc, 0, SEEK_CUR);

Check here.

>         write(floppy_desc, boot_buf, 512);

Check here.

>         close(floppy_desc);
> }

Regards,
Johannes

-- 
"Meine Gegenklage gegen dich lautet dann auf bewusste Verlogenheit,
verlästerung von Gott, Bibel und mir und bewusster Blasphemie."
         -- Prophet und Visionär Hans Joss aka HJP in de.sci.physik
                         <48d8bf1d$0$7510$5402220f@news.sunrise.ch>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]