4th sem practical sample's

Visual Basic

1.KEYBOARD

2.MOUSE

3.DIRECTORY


4.STATICCRTLARY


5.DYNCONTROLARY

6.VARIENTS


7.PAY_ROLL

8.DIFFSTY

9.KEYBOARD

10.MOUSE


11.CALC


12.MOD,MODLES

13.RE&WR DOC


14.SLIDER


15.TREE VIEW


16.RICHEDIT TEXT


17.STAT SPILIT


18.DYNSPLIT


19.REGULAR DLL


20.EXTERN DLL


21.ACTIVEX


22.ODBC


23.IP ADDR


24.WININET





Network Programming
===================
Press Ctrl+F and the type u r prg name easy way to fine...



access access access access access
---------------------------------





#include
#include
#include
#include
int main(int argc,char *argv[])
{
        if(argc!=2)
        printf("\n usage:aout");
        if(access(argv[1],R_OK)<0)
        printf("read access error for %s",argv[1]);
        else
        printf("\n Read Access\n");
        if(open(argv[1],O_RDONLY)<0)
        printf("\nOpen Access Error for %s\n",argv[1]);
        else
        printf("\nOpen Access ok\n");
        return 0;
}



amstrong amstrong amstrong amstrong
-----------------------------------





#include
main()
{
        int n,t,d1,d2,d3;
        printf("\nArmstrong  number from 1 t0 500:\n");
        n=001;
        while(n<=500)
        {
                d1=n-((n/10)*10);
                d2=(n/10)-((n/100)*10);
                d3=(n/100)-((n/1000)*10);
                t=(d1*d1*d1)+(d2*d2*d2)+(d3*d3*d3);
                if(t==n)
                printf("%d\n",t);
                n++;
        }
}
 CAT  CAT CAT CAT CAT CAT
--------------------------





#include
#include
#include
#include
int main(int argc,char *argv[])
{
        FILE *fp;
        char buf[25];
        if(argc!=2)
        {
                printf("Error in argument");
                exit(0);
        }
        fp=fopen(argv[1],"r");
        if(fp==NULL)
        {
        printf("No such file");
        }
        while(fgets(buf,sizeof(buf),fp))
        printf("%s",buf);
        fclose(fp);
        return;
}
chdir chdir chdir chdir
-----------------------



#include
#include
#include
#include
#include
#include
int main(void)
{
        int flag;
        char path[100];
        system("clear");
        system("ls");
        printf("\n\nEnter the path name:");
        scanf("%s",path);
        flag=chdir(path);
        if(flag==0)
        {
                printf("\n\ndirectory changed");
                printf("\n\n");
        printf(“pwd”);
        }
        else
        printf("\nError occured");
}
checkthefile checkthefile checkthefile
--------------------------------------



#include
#include
#include
#include
#include
#include
int main(void)
{
        char *ch1,*ch2,*ch3;
        struct stat temp1,temp2;
        int fd1;
        printf("\nEnter the filename for stat:");
        scanf("%s",ch1);
        if(stat(ch1,&temp1)<0)
        {
                printf("error");
                return;
        }
        if(S_ISREG(temp1.st_mode))
                ch3="regular";
        else if(S_ISDIR(temp1.st_mode))
                ch3="directory";
        else
                ch3="other";
        printf("\nFile type=%s",ch3);
        printf("\nSize=%d",temp1.st_size);
        printf("\nuserId=%d",temp1.st_uid);
        printf("\ngroupId=%d",temp1.st_gid);
        printf("\nn1_node no=%d",temp1.st_ino);
        printf("\nDevice no=%d",temp1.st_dev);
        printf("\nNo of links=%d",temp1.st_nlink);
        printf("\nSize of bytes=%d",temp1.st_size);
        printf("\nThe file name for fstat;File1.c");
        fd1=open("file1.c",O_RDONLY);
        if(fstat(fd1,&temp2)<0)
        {
                printf("\nfstat error");
        }
        if(S_ISREG(temp2.st_mode))
                ch2="regular";
        else if(S_ISDIR(temp2.st_mode))
                ch2="directory";
        else
                ch2="others";
        printf("\nFile types=%s",ch2);
        printf("\nSize=%d",temp2.st_size);
        printf("\nuserid=%d",temp2.st_uid);
        printf("\ngroupid=%d",temp2.st_gid);
        printf("\n i_node no=%d",temp2.st_ino);
        printf("\nDevice no=%d",temp2.st_dev);
        close(fd1);
}

chmod chmod chmod chmod chmod
-----------------------------


#include
#include
#include
int main(void)
{
        struct stat buf;
        char name[50],name1[50];
        printf("Enter the file name for record locking:");
        scanf("%s",name);
        if(stat(name,&buf)<0)
        printf("\nSTAT ERROR FOR %s\n",name);
        if(chmod(name,(buf.st_mode&S_IXGRP)|S_ISGID)<0)
        printf("\n chmod error for %s\n",name);
        else
        printf("%s file has been locked\n",name);
        printf("Enter the file name whose mode to be changed:\n");
        scanf("%s",name1);
        if(chmod(name1,(S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))<0)
        printf("\n chmod error has %s\n",name1);
        else
        printf("\nchmod of the file %s has been changed\n",name1);
        return 0;
}
clisharedmem clisharedmem clisharedmem
---------------------------------------


#include
#include
#include
#include
#define SHMSZ 40
 main()
{
        int shmid;
        key_t key;
        key=3600;
        char *shm,*s;
        if((shmid=shmget(key,SHMSZ,0666))<0)
           printf("\nshmget() error");
        if((shm=shmat(shmid,NULL,0))==(char *)-1)
        {
           printf("\n shmat error");
        }
        system("\n clear");
        printf("\nThis is client");
        printf("\nReading the content in memory\n");
        *shm='*';
        for(s=shm;*s!='\0';s++)
                putchar(*s);
        putchar('\n');
}
creating a file creating a file creating a file
------------------------------------------------





#include
#include
#include
#include
#include
#include
#include

main(int args,char *arg[])
{

  int d1,d2,n;
  char buf[25];

     if(args!=3)
     {

       printf("\n ERROR IN ARGUMENTS \n");
       exit(0);
     }

     if((d1=open(arg[1],O_RDONLY,0666))==-1)
     {

       printf("\n ERROR IN OPENING A FILE ");
     }

     if((d2=creat(arg[2],0666))==-1)
     {
       printf("\n ERROR IN CREATING A FILE \n ");
       exit(0);
     }

     while((n=read(d1,buf,sizeof(buf)))>0)

         if((write(d2,buf,n))!=n)
          {
            printf("\n ERROR IN LOOPING \n ");
            exit(0);
          }
 }
fact fact fact fact fact
-------------------------



#include
int factorial(int n);
 main()
{
        int n;
        printf("\nEnter the number:");
        scanf("%d",&n);
        printf("\nFactorial of given number is:%d",factorial(n));
}
int factorial(int n)
{
        int fact;
        if(n==1)
                return 1;
        else
        {
                fact=n*factorial(n-1);
                return fact;
        }
}
fibo fibo fibo fibo fibo
-------------------------




#include
main()
{
        int a,b,c=0,i,n;
        printf("\nEnter the number:");
        scanf("%d",&n);
        a=0;
        b=1;
        printf("%d\n%d\n",a,b);
        for(i=0;i
#include
#include
#include
#include
int main()
{
        int fd1,fd2,fd,bytes;
        char buf1[300],buf2[300];
        fd1=open("list1",O_RDONLY|O_EXCL);
        fd2=creat("list2",O_WRONLY|O_CREAT|O_TRUNC|O_EXCL);
        if(fd1>=0)
        {
                printf("File name list1 opened successfully");
                bytes=read(fd1,buf1,44);
                if(bytes==0)
                        printf("End of file is reached\n");
                else if(bytes==-1)
                        printf("some errors in Reading list\n");
                else
                        printf("%d Bytes have been read\n",bytes);
        }
        else
                printf("\n some error in opening a file\n");
                if(fd>=0)
                {
                        printf("\nThe file list2 is opened successfully\n");
                        if((bytes==0)||(bytes==-1))
                                printf("\n There is no bytes for writing\n");
                        else
                        {
                                bytes=write(fd2,buf1,44);
                                if(bytes==-1)
                                        printf("\nThere are some errors in writing lists\n");
                                else
                                        printf("%d Bytes have been successfully written\n",bytes);
                        }
                }
                else
                        printf("\nThere are some error in creating list2\n");
                        fd=close(fd1);
                        if(fd>=0)
                                printf("list1 is successfully closed\n");
                        else
                                printf("Some problem in closing list1\n");
                        fd=close(fd2);
                    


   if(fd>=0)
                                printf("list2 is closed successfully\n");
                        else
                                printf("Some problem in closing list2\n");
                        return 0;
}
fork fork fork fork fork
------------------------




#include
#include
#include
#include
int glob=0;
int main()
{
        int loc=0;
        pid_t pid;
        pid=fork();
        if(pid<0)
                printf("\n Process Creation Error");
        else if(pid==0)
        {
                glob++;
                loc++;
        }
        printf("\n pid=%d\n Global Variable=%d\n Local Variable=%d\n",getpid(),glob,loc);
                return 0;
}
grep grep grep grep grep
------------------------



#include
#include
#include
#include
#include
#include
#include
int strmat(char ln[],char pa[]);

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

 char ln[256];
 FILE *fp;

  if(argc==2)
     fp=stdin;

    else if(argc==3)
    {

     fp=fopen(argv[2],"r");
       if(fp==NULL)
       {
         printf("\n FILE CANNOT BE OPEN \n");
         exit(1);
       }
    }
   else
   {
     printf("\n ERROR IN ARGUMENT \n");
     exit(1);
   }

     while(fgets(ln,sizeof(ln),fp))
     {
        if (strmat(ln,argv[1]))
        printf("%s",ln);
     }

 fclose(fp);
}






int strmat(char ln[],char pa[])
{
  int i,j,k;

    for(i=0;ln[i]!='\0';i++)
    {
      for(j=i,k=0;ln[j]==pa[k]&&pa[k]!='\0';j++,k++);
       if(k>0&&pa[k]=='\0')
       return 1;
    }
   return 0;
 }
ipcmsgq ipcmsgq ipcmsgq ipcmsgq ipcmsgq
----------------------------------------




#include
#include
#include
#include
int main()
{
        int msgqid,key=20;
        pid_t pid;
        struct
        {
                long mtype;
                char mtext[50];
        }buf,buf1;
        msgqid=msgget(key,IPC_CREAT|0777);
        pid=fork();
        if(pid==-1)
        printf("\nFork error");
        else
        {
                if(pid==0)
                {
                        printf("\nEnter the text to send:");
                        scanf("%s",buf.mtext);
                        buf.mtype=1;
                        printf("\nThe child is writing message to the parent \n");
                        msgsnd(msgqid,&buf,sizeof(buf.mtext),0);
                        printf("send message:%s\n",buf.mtext);
                }
                else
                {
                        buf.mtype=1;
                        msgrcv(msgqid,&buf1,sizeof(buf.mtext),0,0);
                        printf("\nParent is receiving message from the child\n");
                        printf("\nReceived message:%s\n",buf1.mtext);
                }
        }
        return 0;
}
link link link link link
--------------------------




#include
#include
#include
#include
#include
#include
int main(void)
{
        int flag;
        char acpath[100],sympath[100];
        system("clear");
        system("ls");
        printf("\nEnter the name of Actual path:");
        scanf("%s",acpath);
        printf("\nEnter the link path:");
        scanf("%s",sympath);
        flag=link(acpath,sympath);
        if(flag==0)
        {
                printf("\n link execute successfully");
                printf("\n\n");
                system("ls");
        }
        else
                printf("Error is occured");
}
ls ls ls ls ls ls ls ls ls ls ls ls
--------------------------------------



#include
#include
#include
#include
#include
#include
int main(int argc,char *argv[])
{
        int c=0;
        DIR *dp;
        struct dirent *dirp;
        printf("%s",argv[1]);
        if(argc!=2)
        {
                printf("Error in arguments");
                exit(1);
        }
        if ((dp=opendir(argv[1])) == NULL)
        {
                printf("Error in opening a directory:%s",argv[1]);
                exit(1);
        }
        while((dirp=readdir(dp))!=NULL)
        {
                c++;
                printf("%-10s",dirp->d_name);
                if(c==2)
                {
                        printf("\n");
                        c=0;
                }
        }
        printf("\n");
        closedir(dp);
        return 0;
}
lseek lseek lseek lseek lseek
----------------------------------



#include
#include
#include
#include
#include
#include
int main()
{
        int fd,fp;
        char buf1[10]="India";
        char buf2[10]="My";
        char buf3[10]="Nation";
        fd=open("country",O_EXCL|O_RDWR);
        if(fd>=0)
                printf("\n The file opened,Successfully\n");
        else
        {
                printf("\n Some Error in opening a file\n");
        }
        fp=lseek(fd,0,SEEK_SET);
        printf("\n The file pointer is at the position %d",fp);
        write(fd,buf1,5);
        fp=lseek(fd,0,SEEK_CUR);
        printf("\nThe File pointer is at the position %d after writing %s\n",fp,buf1);
        fp=lseek(fd,0,SEEK_CUR);
        write(fd,buf2,7);
        fp=lseek(fd,0,SEEK_CUR);
        printf("\n The File pointer is at the positon %d after writing %s\n",fp,buf2);
        fp=lseek(fd,15,SEEK_END);
        printf("\nThe File pointer is at the position %d after writing %s\n",fp,buf3);
        write(fd,buf3,19);
        fd=lseek(fd,0,SEEK_CUR);
        return 0;
}
mk,rmdir mk,rmdir mk,rmdir mk,rmdir mk,rmdir
------------------------------------------------




#include
#include
#include
#include
#include
#include
int main(void)
{
        char mdir[100],rdir[100];
        int mflag,rflag;
        system("clear");
        system("ls");
        printf("\nEnter the directory name to create:");
        scanf("%s",mdir);
        mflag=mkdir(mdir,S_IRWXU|S_IRWXG|S_IRWXO);
        if(mflag==0)
        printf("\n\nDirectory created");
        if(mflag==-1)
        {
        printf("directory already exit");
        printf("\nenter the dir name to remove:");
        scanf("%s",rdir);
        rflag=rmdir(rdir);
        }
        if(rflag==0)
        printf("\nDirectory deleted");
        else
        printf("Error in deleting");
        printf("\n\n");
        system("ls");
}
mkdir mkdir mkdir mkdir mkdir
--------------------------------



#include
#include
#include
#include
#include
#include
int main(void)
{
        char dir[100],ch;
        int flag;
        printf("\nEnter the directory name to create:");
        scanf("%s",dir);
        flag=mkdir(dir,S_IRWXU|S_IRWXG|S_IRWXO);
        if(flag==0)
        printf("Directory created");
        else
        printf("exit  directory");
}
more more more more more more
--------------------------------





#include
#include
#include
#include
#include
main(int argc,char *argv[])
{
        int li=0;
        char c,buf[256];
        FILE *fp;
        if((fp=fopen(argv[1],"r"))==NULL)
        {
                printf("Unable to open");
                exit(1);
        }
        while(fgets(buf,sizeof(buf),fp)!=NULL)
        {
                ++li;
                if(li<=10)
                        printf("%s",buf);
                else
                        li=0;
                printf("-----MORE-----");
                c=getchar();
                if(c=='q')
                exit(0);
                printf("%s",buf);
        }
        fclose(fp);
}
prime prime prime prime prime prime
------------------------------------




#include
main()
{
        int i=0,n,c,j;
        printf("\nEnter the no:");
        scanf("%d",&n);
        while(i<=n)
        {
                c=0;
                for(j=1;j<=i;j++)
                {
                        if(i%j==0)
                                c++;
                }
                if(c==2)
                printf("%d      ",i);
                i++;
        }
}
remove remove remove remove remove
--------------------------------------




#include
#include
#include
#include
#include
#include
int main(void)
{
        int flag;
        char path[100];
        system("clear");
        system("ls");
        printf("\n\nEnter the name of file you want to delete:");
        scanf("%s",path);
        flag=remove(path);
        if(flag==0)
        {
                printf("\nDeleted successfully");
                printf("\n\n");
                system("ls");
        }
        else
        {
                printf("Error occured");
        }
}
rename rename rename rename rename
-------------------------------------




#include
#include
#include
#include
#include
#include
int main(void)
{
        int flag;
        char expath[100],newpath[100];
        system("clear");
        system("ls");
        printf("\n\nEnter the name of the file you want to rename:");
        scanf("%s",expath);
        printf("\nEnter the new name of the file:");
        scanf("%s",newpath);
        flag=rename(expath,newpath);
        if(flag==0)
        {
                printf("\nRename successfully");
                printf("\n\n");
                system("ls");
        }
        else
                printf("Error is occured");
}
semaphores semaphores semaphores semaphores
---------------------------------------------




#include
#include
#include
#include
int main()
{
        int i=0,semid,key=100,nsems=1,nsop;
        pid_t pid;
        struct sembuf *sops=(struct sembuf *)malloc(2*sizeof(struct sembuf));
        if((semid=semget(key,nsems,IPC_CREAT))==-1)
                printf("\nSemid creation failed");
        else
        {
                printf("\n sem get success semID:%d\n",semid);
                nsop=1;
                sops[1].sem_num=0;
                sops[1].sem_op=1;
                sops[1].sem_flg=SEM_UNDO|IPC_NOWAIT;
                printf("\n Doing sem op with %d\n",semid);
                if(semop(semid,sops,nsop)==0)
                        printf("\nError \n");
                else
                {
                        printf("\nSem_op released");
                        printf("\nSem is set %d \n",sops[1].sem_op);
                }

        }
        return 0;
}
serversharedmem serversharedmem serversharedmem serversharedmem
----------------------------------------------------------------------





#include
#include
#include
#include
#include
#include
#include
#define SHMSZ 40
main()
{
        char cch,fname[SHMSZ],buff[700],*shm,*s;
        int shmid,fo,n,i;
        key_t key;
        key=3600;
        if((shmid=shmget(key,SHMSZ,IPC_CREAT|0666))<0)
        {
                printf("\nOpen Error");
        }
        if((shm=shmat(shmid,NULL,0))==(char *)-1)
        {
                printf("Error");
        }
        s=shm;
        system("clear");
        printf("\nServer is accepting the file name");
        printf("\nEnter the file name:");
        scanf("%s",&fname);
        fo=open(fname,O_RDWR);
        if(fo<0)
                printf("\nOpen Error\n");
        else
        {
                i=0;
                while(read(fo,buff,sizeof(buff))!=0)
                {
                        for(i=0;i
#include
#include
#include
int main(int argc,char *argv[])
{
        int i;
        struct stat buf;
        char *ptr;
        for(i=1;i
main()
{
        int s=0,n,r=0;
        printf("\nEnter the number:");
        scanf("%d",&n);
        while(n>0)
        {
                r=n%10;
                s=s+r;
                n=n/10;
        }
                printf("\nThe sum of digit is:%d",s);
}
symlink symlink symlink symlink symlink
-----------------------------------------





#include
#include
#include
#include
#include
#include
int main(void)
{
        int flag;
        char acpath[100],sympath[100];
        system("clear");
        system("ls");
        printf("\nEnter the name of Actual path:");
        scanf("%s",acpath);
        printf("\nEnter the symbolic path:");
        scanf("%s",sympath);
        flag=symlink(acpath,sympath);
        if(flag==0)
        {
                printf("\nSymbolic link execute successfully");
                printf("\n\n");
                system("ls");
        }
        else
                printf("Error is occured");
}
systemfn systemfn systemfn systemfn
----------------------------------------




#include
#include
#include
int main()
{
        printf(" Date:\n");
        system("date");
        printf("list:\n");
        system("ls");
        printf("Who am i:\n");
        system("who am i");
        printf("TTy\n");
        system("tty");
        printf("Finger:\n");
        system("finger");
}
tcpclient tcpclient tcpclient tcpclient
---------------------------------------




#include
#include
#include
#include
#include
#include
#include
int main(int argc, char *argv[])
{
        int n,sockfd;
        char buffer[512];
        struct sockaddr_in serv_addr;
        struct hostent *server;
        sockfd=socket(AF_INET,SOCK_STREAM,0);
        server=gethostbyname(argv[1]);
        serv_addr.sin_family=AF_INET;
        bcopy(server->h_addr,&(serv_addr.sin_addr),server->h_length);
        serv_addr.sin_port=htons(8010);
        printf("\nEnter the text to send:");
        scanf("%s",buffer);
        connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr));
        n=write(sockfd,buffer,strlen(buffer));
        return 0;
}
tcpserver tcpserver tcpserver tcpserver
-----------------------------------------





#include
#include
#include
#include
#include
#include
#include
int main()
{
        int n,sockfd,newsockfd,client;
        struct sockaddr_in serv_addr,cli_addr;
        char buffer[512];
        sockfd=socket(AF_INET,SOCK_STREAM,0);
        serv_addr.sin_family=AF_INET;
        serv_addr.sin_addr.s_addr=htonl(INADDR_ANY);
        serv_addr.sin_port=htons(8010);
        bind(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr));
        listen(sockfd,5);
        client=sizeof(cli_addr);
        newsockfd=accept(sockfd,(struct sockaddr*) &cli_addr,&client);
        n=read(newsockfd,buffer,255);
        printf("The received Text is %s",buffer);
        return(0);
}

truncate truncate truncate truncate
--------------------------------------



#include
#include
#include
#include
#include
#include
int main(void)
{
        int flag;
        char path[100];
        system("clear");
        system("ls");
        printf("\n\nEnter the name of the file you want to truncate:");
        scanf("%s",path);
        flag=truncate(path,0);
        if(flag==0)
        {
                printf("\n\nTruncate successfully");
                printf("\n\n");
                system("ls");
        }
        else
        printf("Error in occured");
}
udpclient udpclient udpclient udpclient
------------------------------------------




#include
#include
#include
#include
#include
#include

int main(int argc,char *argv[])
{
int fd;
struct sockaddr_in server;
struct hostent *hp,*gethostbyname();
fd=socket(AF_INET,SOCK_DGRAM,0);
server.sin_family=AF_INET;
hp=gethostbyname(argv[1]);
bcopy(hp->h_addr,&(server.sin_addr),hp->h_length);
server.sin_port=htons(9000);
sendto(fd,"Panimalar",9,0,(struct sockaddr*)&server,sizeof(server));
return 0;
}
udpserver udpserver udpserver udpserver
----------------------------------------




#include
#include
#include
#include
#include

int main(int argc,char *argv)
{

 int sd;
 int rc;
 int sockserverlen;
 char buf[512];

 struct sockaddr_in server,sockserver;

  server.sin_family=AF_INET;
  server.sin_addr.s_addr=htonl(INADDR_ANY);
  server.sin_port=htons(9000);

  sd=socket(AF_INET,SOCK_DGRAM,0);
  bind(sd,(struct sockaddr*)&server,sizeof(server));
  sockserverlen=sizeof(sockserver);
  rc=recv(sd,buf,sizeof(buf),0);
  buf[rc];
  printf("\n RECEIVED TEXT:- %s \n",buf);
}
ulink ulink ulink ulink ulink
------------------------------



#include
#include
#include
#include
#include
int main(void)
{
        int flag;
        char path[100];
        system("clear");
        system("ls");
        printf("\nEnter the name of the file you want to unlink:");
        scanf("%s",path);
        flag=unlink(path);
        if(flag==0)
        {
                printf("\n unlink execute successfully");
                printf("\n\n");
                system("ls");
        }
        else
                printf("Error is occured");
}
umask umask umask umask umask
--------------------------------



#include
#include
#include
#include
#include
main(void)
{
        umask(0);
         umask(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
        if(creat("f1",S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)<0)
        printf("\n Error in creating f1");
        umask(S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
        if(creat("f2",S_IRUSR|S_IWUSR)<0)
        printf("Error in creating f2");
        umask(S_IRUSR|S_IWUSR|S_IROTH|S_IWOTH);
        if(creat("f3",S_IRGRP|S_IWGRP)<0)
        printf("Error in creating f2");
        umask(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
        if(creat("f4",S_IROTH|S_IWOTH)<0)
        printf("Error in creating f2");

}
utime utime utime utime utime
--------------------------------




#include
#include
#include
#include
#include
int main(int argc,char *argv[])
{
        int i;
        struct stat buf;
        struct utimbuf timebuf;
        for(i=1;i






wait wait wait wait wait
-------------------------




#include
#include
#include
#include
int main()
{
        int id,wid,status;
        id=fork();
        if(id==0)
        {
                printf("\n Child Process ID=%d\nParent Process ID=%d\n",getpid(),getppid());
                return 0;
        }
        wid=wait(&status);
        printf("\n Parent Process");
        printf("\n Wait ID=%d\nID=%d\nStatusID=%d\n",wid,getpid(),getppid());
        return 0;
}
========================================================================

No comments:

Post a Comment

Send Feedback to => Searchamaze@gmail.com