
I wrote this program during my high school classes where I used to experiment with c++,experimenting with computer languages is a lot fun.I haven’t edited much, the source code remains the same when it was created.I named the Operating system “Microhard”
Software Details
====================
Developed in : C++
Compiler used : TC++ 3.0
Interface:Command Based.
Prototype: Operating System.
------------------------------------------
---------All commands in OS---------
HELP To see all the commands in Microhard (OPERATING SYSTEM).
EXIT To exit from programe.
DATE For seeing current date.
TIME For seeing current time.
TCLS To clear the text screen.
VER Version of Microhard system.
MKD to make new directory
DELD To delete any directory.
MKF To make any new file
DELF To delete any file
OPEN For opening any file
GO2D To go to another directory.
FIND To findout any file.
TCOLOR for changing text color. eg- TCOLOR 4 ( 1 to 15)
BKCOLOR for changing background color. eg- BKCOLOR 7 ( 1 to 15)
---------Graphics Cammands---------
LINE eg-line 50 300 300 300.
CIRCLE eg- circle 300 200 100
------------------------------------------*/
//SOURCE CODE OF MICROHARD OPERATING SYSTEM.
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define clsg closegraph(); restorecrtmode();
void load();
void prog_by();
int find();
main()
{
clrscr();
textcolor(2);
cprintf("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»nr");
cprintf("º Welcome In ºnr");
cprintf("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼnr");
prog_by();
textcolor(15);
char dir[MAXDIR];
{if (getcurdir(0, dir)) { perror("getcurdir()"); }
int disk=getdisk()+'A';cprintf("%c:\%s]",disk,dir);}//Current drive & directory
// typedef OK sg=1;
#define OK sg=1;
while(1)
{
char *in; // = getchar();
scanf("%s",&*in);
int sg=0;
if(strcmp( in,"exit")==0||strcmp( in,"EXIT")==0||strcmp( in,"x")==0||strcmp( in,"X")==0){exit(0);}
if(strcmp( in,"tcls")==0||strcmp( in,"TCLS")==0 ){OK clrscr();}
if( strcmp( in,"ver")==0||strcmp( in,"VER")==0)
{ OK prog_by();}
if( strcmp( in,"date")==0||strcmp( in,"DATE")==0)
{OK time_t t; time(&t); cprintf("nrCurrent Date %snr",ctime(&t));}
if( strcmp( in,"find")==0||strcmp( in,"FIND")==0)
{OK find();}
if( strcmp( in,"time")==0||strcmp( in,"TIME")==0){OK struct time t; gettime(&t);
cprintf(" Current Time : %2d:%02d:%02d.%02dnr",
t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund); }
if( strcmp( in,"mkd")==0||strcmp( in,"MKD")==0)
{OK char *dir; scanf("%s",&*dir); int stat;
stat = mkdir(dir);
if (!stat)
cprintf("Directory creatednr");
else
{cprintf("Unable to create directorynr");}
}
if( strcmp( in,"deld")==0||strcmp( in,"DELD")==0)
{OK char *dir_name; scanf("%s",&*dir_name); //system("dir/p");
int stat;
stat = rmdir(dir_name);
if (!stat)
cprintf("nrDirectory deletednr");
else
{cprintf("Unable to delete directorynr");}
}
if( strcmp( in,"a:")==0||strcmp( in,"A:")==0)
{OK // char *dir_name; scanf("%s",&*dir_name); //system("dir/p");
//int a;scanf("%d",&a);
if ( _chdrive(1) == 0)
cprintf("Successfully changed to drive nr");
else
cprintf("Cannot change to drive nr");
}
if( strcmp( in,"c:")==0||strcmp( in,"C:")==0)
{OK // char *dir_name; scanf("%s",&*dir_name); //system("dir/p");
//int a;scanf("%d",&a);
if ( _chdrive(3) == 0)
cprintf("Successfully changed to drive nr");
else
cprintf("Cannot change to drive nr");
}
if( strcmp( in,"d:")==0||strcmp( in,"D:")==0)
{OK // char *dir_name; scanf("%s",&*dir_name); //system("dir/p");
//int a;scanf("%d",&a);
if ( _chdrive(4) == 0)
cprintf("Successfully changed to drive nr");
else
cprintf("Cannot change to drive nr");
}
if( strcmp( in,"e:")==0||strcmp( in,"E:")==0)
{OK // char *dir_name; scanf("%s",&*dir_name); //system("dir/p");
//int a;scanf("%d",&a);
if ( _chdrive(5) == 0)
cprintf("Successfully changed to drive nr");
else
cprintf("Cannot change to drive nr");
}
if( strcmp( in,"mkf")==0||strcmp( in,"MKF")==0)
{ OK
int handle;
char *msg; char *path;
cprintf("Give the path and file name. eg d:\xyz\sss.txtnr");
scanf("%s",&*path);
if ((handle = open(path, O_CREAT | O_TEXT)) == -1)
{
perror("Error:");
getch();
// return 1;
}
scanf("%s",&*msg);
write(handle, msg, strlen(msg));
cprintf("File created %snr",path);
close(handle);
// return 0;
}
if( strcmp( in,"go2d")==0||strcmp( in,"GO2D")==0)
{ OK
char *msg; char *path;
cprintf("Give the path. eg d:\xyznr");
scanf("%s",&*path);
int result= chdir(path);
if(result==0){ cprintf("chaned succecfuly nr");}
else{cprintf("error nr");}
}
if( strcmp( in,"open")==0||strcmp( in,"OPEN")==0)
{ OK
int result; char *path;
cprintf("Give the path. eg d:\xyznr");
scanf("%s",&*path);
result = spawnle(P_WAIT,path,NULL,NULL);
if (result == -1)
{ perror("Error from spawnle"); }
if(result==0){ cprintf(" success nr");}
}
//=====================graphics===================
if(strcmp( in,"circle")==0 )
{OK load();
int x,y,r;scanf("%d%d%d",&x,&y,&r);
circle(x,y,r); getch();clsg restorecrtmode();}
if(strcmp( in,"line")==0 )
{OK load();
int x,y,x1,y1;scanf("%d%d%d%d",&x,&y,&x1,&y1);line(x,y,x1,y1);getch();clsg}
if(strcmp( in,"tcolor")==0||strcmp( in,"TCOLOR")==0 ) {OK int a;scanf("%d",&a);textcolor(a);}
if(strcmp( in,"color15")==0 ) {textcolor(15);}
if(strcmp( in,"bkcolor")==0||strcmp( in,"BKCOLOR")==0 ) {OK int a;scanf("%d",&a);textbackground(a);}
//=======================================
if( strcmp( in,"help")==0||( strcmp( in,"HELP")==0))
{ OK
cprintf("ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍnr");
cprintf("ÄÄÄÄÄÄÄÄÄAll commands in OSÄÄÄÄÄÄÄÄÄnrnr");
//cprintf(" colornr exitnr vernr helpnr clsnr timenr datenr findnr cdnr");
//cprintf("mdnr rdnr");
//cprintf("nr");
cprintf("HELP To see all the commands in Microhard(OPERATING SYSTEM).nr");
cprintf("EXIT To exit from programe.nr");
cprintf("DATE For seeing current date.nr");
cprintf("TIME For seeing current time.nr");
cprintf("TCLS To clear the text screen.nr");
cprintf("VER Version of Microhard system. nr");
cprintf("MKD to make new directorynr");
cprintf("DELD To delete any directory.nr");
cprintf("MKF To make any new filenr");
cprintf("DELF To delete any filenr");
cprintf("OPEN For opening any filenr");
cprintf("GO2D To go to another directory.nr");
cprintf("FIND To findout any file.nr");
cprintf("TCOLOR for changing text color. eg- TCOLOR 4 ( 1 to 15)nr");
cprintf("BKCOLOR for changing background color. eg- BKCOLOR 7 ( 1 to 15)nr");
//cprintf("nr");//cprintf("nr");//cprintf("nr");
cprintf("ÄÄÄÄÄÄÄÄÄGraphics CammandsÄÄÄÄÄÄÄÄÄnrnr");
cprintf("LINE eg-line 50 300 300 300.nr");
cprintf("CIRCLE eg- circle 300 200 100nr");
cprintf("ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍnr");
}
if(sg==0){cprintf("nrBad Cammand!!!");cprintf(" (Type HELP to see all commands)nr");}
char dir[MAXDIR];
{if (getcurdir(0, dir)) { perror("getcurdir()"); }
int disk=getdisk()+'A';cprintf("%c:\%s]",disk,dir);}//Current drive & directory
// cprintf("%c:\%s]",disk,dir);// Current drive & directory
//if(strcmp(in,"lor")==0||strcmp( in,"TCOLOR")==0
//strcmp(in,"tcolor")==0||strcmp( in,"TCOLOR")==0
//strcmp(in,"tcolor")==0||strcmp( in,"TCOLOR")==0
//){}
}//while
}////////////////////////////////////////////////////////end_main()
void load()
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{ clrscr();
cprintf("GRAPHICS ERROR: %snr", grapherrormsg(errorcode));
cprintf(" PRESS ANY KEY TO EXIT or RESTART THE PROGRAME.");
getch();
}
}
//--------------------------------------------------------------------
void prog_by()
{
cprintf("ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßnr");
cprintf("Microhard (Operating System) Version 1.0nrProgramed by ASKOPPAL");
cprintf("nrCopy Right 2000-2007 Microhard(c).nr");
cprintf("nrTYPE help TO SEE ALL COMMANDSnr");
cprintf("ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßnr");
}
int find(void)
{
struct ffblk ffblk;
int done;
char *find;
cprintf("Find What? eg. d:\xyz\*.exenr");
scanf("%s",&*find);
cprintf("Finding for %snr",*find);
done = findfirst(find,&ffblk,0);
while (!done)
{
cprintf("%snr", ffblk.ff_name);
done = findnext(&ffblk);
}
return 0;
}
“If you liked this article, please share it on del.icio.us, StumbleUpon or Digg. I’d appreciate it.
”
Hello!
Very Interesting post! Thank you for such interesting resource!
PS: Sorry for my bad english, I’v just started to learn this language
See you!
Your, Raiul Baztepo
thanks Raiul
sorry, but the include libraries? where are these?
There is some error in my code highlighter plugin,you can get the code from here http://askoppal.googlepages.com/MHOS.txt
The best information i have found exactly here. Keep going Thank you
Hello Guru, what entice you to post an article. This article was extremely interesting, especially since I was searching for thoughts on this subject last Thursday.
Hi! I was surfing and found your blog post… nice! I love your blog.
Cheers! Sandra. R.
thanks Sandra !
For me, the best operating system is Linux because it rarely hangs.*~;
Wonderful blog! I found it while browsing on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it
Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why waste your intelligence on just posting videos to your weblog when you could be giving us something enlightening to read?
Hi there, just became aware of your blog through Google, and found that it’s really informative. I am gonna watch out for brussels. I will be grateful if you continue this in future. Many people will be benefited from your writing. Cheers!
Great write-up, I am regular visitor of one¡¦s web site, maintain up the nice operate, and It is going to be a regular visitor for a long time.
Heyho, good post! I will keep visiting your blog
Wow, fantastic info in your blog post. I look forward to seeing more of your blog in the future. Added to favorites!
Howdy very cool web site!! Guy .. Excellent .. Amazing .. I will bookmark your blog and take the feeds also…I’m satisfied to search out so many useful info here in the put up, we want develop extra techniques on this regard, thank you for sharing.
That is a great article!
Great Blog! I’ll bookmark it! Thanks and bye!
Oh my goodness an incredible article dude. Thank you However I’m experiencing issue with ur rss . Don’t know why Unable to subscribe to it. Is there anyone getting identical rss drawback? Anyone who knows kindly respond. ThnkxUseful info mayonnaise calories
Great paintings! That is the type of info that should be shared around the web. Disgrace on Google for now not positioning this publish upper! Come on over and discuss with my site . Thanks =)
I really like the layout of this page it’s straightforward to read.
What might be the best technique to keep up to date on the website? Thanks a lot.
I chanced upon your site by an opinion from another law post and I am delighted I did. Wonderful stuff you’ve got in this blog…not sure if it’s a bug or not but the header seems a little out of sync in my web browser.
Some really nice and utilitarian information on this web site, likewise I think the style and design holds fantastic features.
Great document! I’m all for it. The article is absolutely helpful if you ask me. Reading a person’s article makes me content. At duration, I may learn a great deal more knowledge. Thanks quite definitely.
I don’t even know how I stopped up here, however I believed this submit used to be great. I don’t understand who you might be but certainly you are going to a famous blogger in case you aren’t already
Cheers!