C++ or the computer more in depth


How did we do things and solved problems more manually before all these libraries?

I mean. For example, how could you loop through a whole folder(c:\mymapp) and capture all the contents in it(like files/other folders), and then add all this into a variable?

It's just an example of many where we get help from libraries today. But I start to feel limited when I do not understand how things like this can be done manually.
Ultimately, you ask the operating system. If the operating system comes with libraries (for example, the Win32 API in windows), then you have headers to include, libraries to link against, to do these things.

If they don't come with such libraries, if they come with no way to ask the OS to do these things for you, then you can't do them.

Whoever creates the OS creates libraries for you to use to do these things and bundles them with the OS.

Other libraries that you can use - for example Qt or Boost - still have to ask the OS to do it. They still have to use the provided OS API. They just hide some details from you.

Thank you for making it clear. Where do I start if I want to write my own OS?
This is great. Thank you.
ah, the good old days.
you wrote it yourself.

if you can't ask the OS, you do it yourself. Talking files and such .. I remember dealing with the disk directly, reading its FAT entries and such. The disk itself knows whats on it, sort of, though the formats for how that is stored varies. If you mess up, the disk is lost and you get to re-format it and try again. We were doing this stuff to floppies, so if we trashed them it took like 30 seconds to retry. I wouldn't start with a hard-drive ;) Maybe a USB stick that you don't care about?



Last edited on

Hey man. It does not sound like a bad idea. It may be educational. Let's try with usb.
Any suggestions for searchwords on the web that can put me in the right direction?
well, you probably want to start with your 'os'. Google how to write a simple operating system, see if you can get something useful there. Moving it to the USB to boot it up comes after you have something to boot, but while doing the simple OS look at how to do 'low level disk access'.

you are quickly getting outside what I know anything about. The gist of it is that disks contain a special sector called a boot sector that holds a small program that launches the real OS program. That is all it does, is launch the other program, by understanding the disk and hardware well enough to locate and read and execute the main OS engine program. Then your OS fires up and follows a basic pattern of getting user input and executing the actions; old OS this would be typed commands lead to actions, newer OS use a mouse / gui but that still renders down to commands to process. The main functions of a simple OS are being able to do file manipulations (copy, delete, etc) and the ability to cause a program to execute when asked to do so.
Last edited on
If you want to write a simple OS, take a look at wiki.osdev.org
Topic archived. No new replies allowed.