/*Implementation of mkdir command */
#include<stdio.h>
#include<stdlib.h>
#include<sys/stat.h>
void usage(const char *myname)
{
printf(“\nUsage: %s <pathname> [<mode>]\n\n”, myname);
exit(1);
}
void main(int argc, char *argv[])
{
int mode;
if(argc<2)
usage(argv[0]);
if(argc==2)
mode = 0777;
elseif(sscanf(argv[2], “%o”, &mode==0)
{
printf(“%s : Invalid Mode\n”, argv[0]);
exit(1);
}
if(mkdir(argv[1], mode)== -1)
perror(argv[0]);
else
printf(“%s directory is created successfully”, argv[1]);
}
February 8, 2010
Categories: Operating System . Tags: OS . Author: Roy Antony Arnold . Comments: Leave a Comment
DDA Line Drawing Algorithm
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<ctype.h>
#include<math.h>
#include<stdlib.h>
void draw(int x1,int y1,int x2,int y2);
void main()
{
int x1,y1,x2,y2;
int gdriver=DETECT,gmode,gerror;
initgraph(&gdriver,&gmode,”c:\\tc\\bgi:”);
printf(“\n Enter the x and y value for starting point:\n”);
scanf(“%d%d”,&x1,&y1);
printf(“\n Enter the x and y value for ending point:\n”);
scanf(“%d%d”,&x2,&y2);
Read More…
February 8, 2010
Categories: Algorithms, Computer Graphics . Tags: Graphics, Algorithm . Author: Roy Antony Arnold . Comments: Leave a Comment
Program to display a simple menu
#include <afxwin.h>
#include “resource.h”
class myframe:public CFrameWnd
{
private:
CMenu menu;
public:
myframe()
{
Create(0,”Creating Menu Using LoadMenu and SetMenu”);
}
int OnCreate(LPCREATESTRUCT I)
{
CFrameWnd ::OnCreate(I);
menu.LoadMenu(IDR_MENU1);
SetMenu(&menu);
return 0;
}
Read More…
January 18, 2010
Categories: Visual Programming . Tags: VC++, VP . Author: Roy Antony Arnold . Comments: Leave a Comment