Wednesday 19 February 2014

How to create Charcter Count detection in Linux programming

-------------------------
Sender side code
-------------------------
#include<stdio.h>
#include<fcntl.h>
#include<string.h>

void main()
{
    int fout,cnt;
    char msg[20];

    printf("\n\n\t\tENTER YOUR MESSAGE :");
    gets(msg);
    cnt=strlen(msg);
    fout=open("pipe",O_WRONLY);
    write(fout,&cnt,sizeof(int));
    write(fout,&msg,cnt);

    close(fout);
     printf("YOUR MESSAGE SUCCESSFULLY SEND..!!! ");
}

------------------------------------------------
Reciver side code
------------------------------------------------

#include<stdio.h>
#include<fcntl.h>
#include<string.h>

void main()
{
    int fout,cnt,len;
    char msg[20];

    fout=open("pipe",O_RDONLY);



    read(fout,&cnt,sizeof(int));
    read(fout,&msg,cnt);

   len=strlen(msg);
     if(len==cnt)
    {
   printf("\n\n\t\tYOUR MESSAGE : %s SIZE:%d",msg,cnt);

     printf("YOUR MESSAGE SUCCESSFULLY RECIVED..!!! ");

    }
   else
    { printf("YOUR MESSAGE NOT SUCCESSFULLY RECIVED..!!! ");}
   close(fout);
}
---------------------------------------------------------
HOW TO RUN IT

STEP 1 :>CREATE TWO FILE SENDER.C AND RECIVER.C IN VI EDITOR

STEP 2 :> COMPILE THOSE TWO FILE AS BELOW
 
                      cc sender.c -o sender.out

                      AND NEXT FILE FOR RECIVER
   
                      cc reciver.c -o reciver.out
STEP 3 :>NOW YOU HAVE TO PUT RECIVER SIDE RUNNING PROCESS  IN BACKGROUND
           
                      ./reciver.out &
             
                  ABOVE CODE GENERATE THE BACKGROUND PROCESS OF RECIVER.C
STEP 4 :> NOW RUN SENDER FILE
             
                 ./sender.out

IF YOU NOT DONE AS ABOVE INSTRUCTION THEN CONTACT ME OR LEAVE COMMENT

How to check Error in Recieving Message in Networking in C

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
  int  lrc[4],vrc[4],LF=0,VF=0,temp[4][4];
  int i,j,flag=0;
  clrscr();
  printf("\n\n\t\tPROGRAMM FOR COUNTING BIT\n\n");
  for(i=1;i<=3;i++)
  {
     for(j=1;j<=3;j++)
     {
      printf("\n\t\tENTER VALUE FOR temp[%d][%d] : ",i,j);
      scanf("%d",&temp[i][j]);
       if(temp[i][j]==1)
       {
    flag++;
       }
     }
     flag=flag%2;
     if(flag==0)
       {vrc[i]=0;}
     else
    {vrc[i]=1;}
      flag=0;
    }

flag=0;

for(i=1;i<=3;i++)
  {
     for(j=1;j<=3;j++)
     {
      printf(" %d ",temp[i][j]);
      if(temp[j][i]==1)
       {
    flag++;
       }
     }
     flag=flag%2;
     if(flag==0)
       {lrc[i]=0;}
     else
    {lrc[i]=1;}
      flag=0;
      printf("\n");
  }

  printf("\n\n\tV R C : ");
  for(i=1;i<=3;i++)
  {
   printf(" %d ",vrc[i]);
   if(vrc[i]==1)
     VF++;
  }
 printf("\n\n\tL R C : ");
  for(i=1;i<=3;i++)
  {
   printf(" %d ",lrc[i]);
   if(lrc[i]==1)
     LF++;
  }
 printf("LF :%d VF :%d",LF,VF);
 if(LF%2==1&&VF%2==1)
 {
  printf("\n\n\t\tYOU HAVE SUCCESSFULLY MEASSAGE IS RECIVED..!!!");
 }
 else
 {  printf("\n\n\t\tFAILED TO LOAD");
 }



   getch();
}

Wednesday 5 February 2014

How to shutdown your PC in 5 second using Command Prompt

Step 1 : Click on start and open RUN .

Step 2: Write cmd to open Command Prompt.

             write below code

           shutdown -s -t 5 

     Note: -t 5     indicates your PC shutdown in 5 seconds 

               

How to create un-deletable folder in your computer.

Make Undeletable, Unrenamable Folders 

like con,aux,lpt1, lpt2, lpt3, lpt4, lpt5, lpt6, lpt7, lpt8 and lpt9.

 

Tricks 1:

Step 1:  Open your Run

Step 2: Type cmd  to open  command prompt and select your Drive where you want to create folder

Step 3:

              write the below code in command promt 

                      md con\

                      like this

 Note: To remove this Folder

        Just  write     rd con\

Trick 2:

     Step 1:         Create Folder  and rename it and Press ALT key and rename it with name  " con "

   Step   2:     Now Release ALT key and press enter

 

        


How to change Background color by selecting color from Listview

activitymain.xml file::> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xm...