Running files
Running files
Hi
I'm busy making a very simple OS together with a friend, we have just started and we have alsmost no knowledge of C and ASM. We strapped a bootloader and a little kernel of another OS that is written in C, and we would like to implement the ability of running files.
What should we do in order to run a file that has been put in the f variable?
The file should be a file without an extension, such as 'demo' or so.
We have tried several things, like inputting a file name using f=scanf() and then doing run(f). The only thing that happens is that the computer freezes.
I hope any of you can help this beginning OS programmers...
Thanks
I'm busy making a very simple OS together with a friend, we have just started and we have alsmost no knowledge of C and ASM. We strapped a bootloader and a little kernel of another OS that is written in C, and we would like to implement the ability of running files.
What should we do in order to run a file that has been put in the f variable?
The file should be a file without an extension, such as 'demo' or so.
We have tried several things, like inputting a file name using f=scanf() and then doing run(f). The only thing that happens is that the computer freezes.
I hope any of you can help this beginning OS programmers...
Thanks
RE:Running files
I found out that something that is being executed by C's run command should be 11 characters long and in capital letters, eg "DEMO COM" for DEMO.COM. The scanf() fnction does, however, only use lower case, even when you type somthing in caps.
Does anybody know a string manipulation library or something like that for C (not C++, just C)?
Thanks
Gyarnoc
Does anybody know a string manipulation library or something like that for C (not C++, just C)?
Thanks
Gyarnoc
RE:Running files
Well, your first mistake was attempting to write an OS in C and Assembly, without actually knowing C or Assembly. That's about the equivalent of building the CN Tower without knowing anything about architecture.
Your second mistake was calling libc methods in an OS, which you must rewrite to exist in your own OS (you are, afterall, writting an OS...!). Last I checked 'run' wasn't a standard C function, either... and if it does, indeed, accept only 11 character names, then it's obviously an old DOS function... in other words, it's useless for OS development.
Third, scanf does _NOT_ only use lower case. scanf reads in exactly what you type in, upper AND lowercase:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
char whatever[50];
scanf("%s", &whatever);
printf(whatever);
return 0;
}
And, lastly... it's obvious you don't know C, because C products it's own string manipulation routines. And for those functions you can't find, you should be able to write them. You might wanna take a look at toupper() and tolower().
My recommendation; learn the languages first (while writting something OTHER THAN one of the most difficult things to write) and then, perhaps, you can make an attempt at writting an operating system.
Cheers,
Jeff
Your second mistake was calling libc methods in an OS, which you must rewrite to exist in your own OS (you are, afterall, writting an OS...!). Last I checked 'run' wasn't a standard C function, either... and if it does, indeed, accept only 11 character names, then it's obviously an old DOS function... in other words, it's useless for OS development.
Third, scanf does _NOT_ only use lower case. scanf reads in exactly what you type in, upper AND lowercase:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
char whatever[50];
scanf("%s", &whatever);
printf(whatever);
return 0;
}
And, lastly... it's obvious you don't know C, because C products it's own string manipulation routines. And for those functions you can't find, you should be able to write them. You might wanna take a look at toupper() and tolower().
My recommendation; learn the languages first (while writting something OTHER THAN one of the most difficult things to write) and then, perhaps, you can make an attempt at writting an operating system.
Cheers,
Jeff
RE:Running files
Well, we've making this routines in ASM, and then make some sort of library for the routines in C. AND IT WORKS! And with writing an os, we learn it on the way... And why don't you help us then? I thought this site was for OS dev?
Veulnet
Veulnet
RE:Running files
Just because its an os dev m.board does not mean people HAVE to help you.
OR, it could be that people cant help you. No person on this board is an oracle of os development, some come close though.
Dangamoose
OR, it could be that people cant help you. No person on this board is an oracle of os development, some come close though.
Dangamoose
RE:Running files
First of all, if you didn't want to get flamed to hell, you shouldn't have introduced yourself as a dever with no asm/C experience...
Maybe you're looking for something like this:
{
printf("Program to execute: ");
in=input();
run(in);
}
Of course your execution function needs to be able to exept the parameter as the thing it's supposed to run, and that's a whole other story! Can you post your run(); function here so we can see it?
Maybe you're looking for something like this:
{
printf("Program to execute: ");
in=input();
run(in);
}
Of course your execution function needs to be able to exept the parameter as the thing it's supposed to run, and that's a whole other story! Can you post your run(); function here so we can see it?
RE:Running files
Sadly the most likely explaination for you getting this far, even though you have no programing experience, is that you are stealing code (or the whole os!) from other people. This is one of the sickest most dishonest things a programmer of any type can do. I'm not accusing you of anything, but you should re-consider os programing until you can use your own code.
On a more light-hearted note, maybe it's not how you load the program, but what the program contains. Could you also post the program you are trying to run?
If it is extremely complex, just write a 'hello, world!' program and try to run that. If it still doesn't work, post the 'hello, world!' program here.
Thanks.
On a more light-hearted note, maybe it's not how you load the program, but what the program contains. Could you also post the program you are trying to run?
If it is extremely complex, just write a 'hello, world!' program and try to run that. If it still doesn't work, post the 'hello, world!' program here.
Thanks.
RE:Running files
Do you think that we are stupid? The os we downloaded was nothing but a bootloader, and a C program that displayed some text. There wasn't even a command prompt, we programmed that ourselves. The 'run' function was available with the compiler we used, but we are not going to post it, because you will be sick and dishonest, because you will steal the code.
We also think this is a really pathetic forum, because you don't give us a meaningful answer, the only thing you guys do is just critisise us, and pretend we are idiots. Well, you are.
Thank you...
We also think this is a really pathetic forum, because you don't give us a meaningful answer, the only thing you guys do is just critisise us, and pretend we are idiots. Well, you are.
Thank you...
RE:Running files
This site is made and maintained by someone in their own time. Its not a company, people dont HAVE to help you, give meaningful answers of any kind.
The people who answer messages on this forum do it in their own time.
You're also the one that started getting snappy when no one answered, which they're not obliged to do, so others snap back.
If you dont like the board, then dont use it.
Others exist, check out alt.os.development on google groups.
Dangamoose
The people who answer messages on this forum do it in their own time.
You're also the one that started getting snappy when no one answered, which they're not obliged to do, so others snap back.
If you dont like the board, then dont use it.
Others exist, check out alt.os.development on google groups.
Dangamoose
RE:Running files
Why would I steal code from you, after declaring it a sick and dishonest thing to do? Besides, functions like that don't come with a compiler. It is contained in the assembly part of the kernel. Obviously the "os you downloaded" comes with a library of functions, run() being one of them.
As for not liking this forum, as Dagamoose pointed out you don't need to. It's all for the better because the community couldn't handle another newbie, especialy one who attacks the person who is JUST TRYING TO HELP!
As for not liking this forum, as Dagamoose pointed out you don't need to. It's all for the better because the community couldn't handle another newbie, especialy one who attacks the person who is JUST TRYING TO HELP!
RE:Running files
You wouldn't let me help! I asked to see your run() function so I could see if it accepted this type of syntax, and you refused!
RE:Running files
well you see here the problem could be the fact that youre mother board is cracked. if not check your windows start menu for the fix all command.