Showing posts with label Advancen c. Show all posts
Showing posts with label Advancen c. Show all posts

Wednesday, 2 September 2009

Write a c programming code to create simple paint brush software


Write a c programming
code to create simple paint brush software or application

#include

#include

#include

#include

void main()

{

int x,y,b,px,py,c,p,s,cl;

int d=0,m;

union REGS i,o;

initgraph(&d,&m,"c:\tc");

i.x.ax=1;

int86(0x33,&i,&o);

i.x.ax=8;

i.x.cx=20;

i.x.dx=450;

int86(0x33,&i,&o);

printf("Brush style insert number from 0 to 5  : ");

Cursor program by c programming.


(1) Write a c program which changes the position of cursor?



Answer:




#include

#include

void main()

{

union REGS i,o;

i.h.ah=2;   //positioning the cursor 

i.h.bh=0;

i.h.dh=30;   

i.h.dl=45;

int86(0x10,&i,&o);

printf("World");

getch();

}



Write a c program to display mouse pointer

Mouse programming in c

System Level programming by c program

Cursor program

Write a c program to display mouse pointer







Write a c
program to display mouse pointer




#include

#include



void main()

{

union REGS i,o;

i.x.ax=1;

int86(0x33,&i,&o);

getch();

}




Explanation: To write such program you must have one interrupt table. Following table is only small part of interrupt table.







To see complete interrupt table click here

This table consists for column. They are:

(1)  

Sunday, 3 February 2008

System Level programming by c program



Important structure and union:




The header file dos.h defines two important structures and one union. They are:

1. struct BYTEREGS {

unsigned char al, ah, bl, bh;

unsigned char cl, ch, dl, dh;

   };



2. struct WORDREGS {

unsigned int ax, bx, cx, dx;

unsigned int si, di, cflag, flags;

   };



3. union REGS {

struct WORDREGS x;

struct BYTEREGS h;

  };




Note: Try to remember

Monday, 7 January 2008

Write the c program to switch the 256 color graphics mode



Write
the c program to switch the 256 color graphics mode



#include#includevoid main(){   int x,y,b;   union REGS i,o;   i.h.ah=0;   i.h.al=0x13;   int86(0x10,&i,&o);   getch();}



Write a c program to create a directory in current working directory?

#include
#includevoid main(){   union REGS i,o;   i.h.ah=0x39;   i.x.dx="ravan";   int86(0x21,&i,&o);   
   

Project in c

Write a c program to create a simple paint brush deginer ?Ans:#include#include#include#include void main(){int x,y,b,px,py,c,p,s,cl;int d=0,m;union REGS i,o;initgraph(&d,&m,"c:\\tc\\bgi");i.x.ax=1;int86(0x33,&i,&o);i.x.ax=8;i.x.cx=20;i.x.dx=450;int86(0x33,&i,&o);printf("Brush style insert number from 0 to 5 : ");scanf("%d",&p);printf("Brush size insert

Sunday, 6 January 2008

How to create dos command in c?



(1) Create a dos command: type by c program.



Answer:




Step 1: Write following code.




#include

void main(int count,char * argv[])

{

int i;

FILE *ptr;

char *str;

char ch;

if(count==1)

{

printf("The syntax of the command is incorrect.\n");

}

for(i=1;i
{

ptr=fopen(argv[i],"r");

if(ptr==NULL)

{

printf("The system cannot find the file specified.");

if(

Create dir command in c


C program or code to create DOS command DIR

Step 1: Write following code.






#include 



#include 



int main(int count,char *argv[]){



struct find_t q ;



    int a;





    if(count==1)



        argv[1]="*.*";





    a = _dos_findfirst(argv[1],1,&q);



  

if(a==0){



   
     while (!a){



   
         printf(" 
%s\n", q.name);



   
         a =

Saturday, 5 January 2008

How to create virus in c?




Create simple virus by c programming language.(Only for study)





Write c program which shutdown the window operating system?



Answer:





Step 1: Write the following program in TURBO C.





#include

#include



int main (void){



    system("shutdown -s");



    return 0;

}





Step 2: Save the above file. Let file name is close.c



Step 3: Only compile the above

Thursday, 3 January 2008

Mouse programming in c


(1) Write a c program which restricts the movement of pointer?
Answer:




//restrict the x and y coordinate

#include

#include

void main()

{

union REGS i,o;

//show mouse pointer

i.x.ax=1;

int86(0x33,&i,&o);

//x coordinate restriction

i.x.ax=7;

i.x.cx=20;

i.x.dx=300;

int86(0x33,&i,&o);

//y coordinate restriction

i.x.ax=8;

i.x.cx=50;

i.x.dx=250;

int86(0x33,&i,&o