Page 1 of 1

C header files

Posted: Mon Nov 04, 2002 7:59 pm
by adeelmahmood1
I am a little bit confuse about the C header files .. as these files are just text files .. the bootloader file and the C kernel or may be a 2nd stage loader too .. all of these we load in sectors of floppy .. i m using windows so i use partcopy for that ..

now my question is that as we have all the definitions of the functions in those header files how do we keep them attached to our operating system .. if your answer is that copy the bootsector and the kernel on the sectors of the floppy with partcopy and just normal copy the header files in the floppy and include them in our C code ...

then how we will copy them to the floppy coz when i use partcopy to write on any sector of the floppy it becomes unusable by windows or Dos .( it is still usable by partcopy ). so as we cannot access the contents of floppy normally in windows how we can copy something into it ??
or if u do something else . plz let me know ..
and just to remind that i asked this question in another thread to Tom but i think he didnt understood my question completely thats why i m posting it here with more explaination.
thanx for ur help

Re:C header files

Posted: Mon Nov 04, 2002 8:04 pm
by SGreenslade
Well, my C is a little rusty, but I think all you have to do is to move the header into the same directory as the compiled executable. You might have to compact the whole thing together using winzip if you wish to upload it on a site somewhere. Otherwise if the program has to recognise the directory where the header is, I don't think I can help you there.

Re:C header files

Posted: Mon Nov 04, 2002 8:09 pm
by SGreenslade
I never heard of that sort of thing...a header is just a textfile isn't it? Since you can access it with partcopy why not just move the contents through the clipboard to another text file and use that as the header?

Re:C header files

Posted: Mon Nov 04, 2002 8:16 pm
by adeelmahmood1
well u r misunderstanding my question .. if my OS is on floppy i have to copy everything related to it on floppy .. and if i cant access the floppy in a normal way ... then what should i do .. there is no clipboard thing involved here

Re:C header files

Posted: Mon Nov 04, 2002 8:21 pm
by SGreenslade
Well if it is still usable by partcopy and partcopy is what rendered inaccessible in the first place can't you just simply reverse the process?

Re:C header files

Posted: Mon Nov 04, 2002 8:21 pm
by Friend
Hi,

A C header file is needed only at compile time, once you have compiled to code files the header files are in with the code (so to speak). Mainly header files are just for the compiler, they normally hold function prototypes and #defines and stuff like that, most of a header file is not even ever seen by code. Just include the header files in you code by using the #include directive and then copy your compiled code as normal to a disk using partcopy, you dont need header files on your boot disk.

hope this helps.

Re:C header files

Posted: Mon Nov 04, 2002 8:31 pm
by adeelmahmood1
thanx alot thats what i was looking for

Re:C header files

Posted: Tue Nov 05, 2002 2:29 am
by grey wolf
adeelmahmood1 wrote: then how we will copy them to the floppy coz when i use partcopy to write on any sector of the floppy it becomes unusable by windows or Dos .( it is still usable by partcopy ). so as we cannot access the contents of floppy normally in windows how we can copy something into it ??
or if u do something else . plz let me know ..
and just to remind that i asked this question in another thread to Tom but i think he didnt understood my question completely thats why i m posting it here with more explaination.
thanx for ur help
when you write your boot sector to the floppy, it has to contain a FAT12/16 information block within the boot code itself. i don't use FAT12 floppy images, so i can't help you there beyond that. but most of the bootsector tutorials i've seen show what needs to be in the boot sector for the FAT12 floppy to work.

if your boot sector is properly formed, the floppy should work as normal.

this page has a good example.