Tag Archives: c programming

Sockets – Basics

Sockets ======= A socket is a communication mechanism that allows client/server systems to be developed either locally,on a single machine, or across networks. – It is a communication mechanism – It allows client/server systems to developed either locally or across … Continue reading

Posted in Project 04: FTP based Client Server using Threads and Sockets | Tagged , , , , | Leave a comment

fgets – scanning string with spaces

Prototype : – #include <stdio.h> char *fgets(char *s, int size, FILE *stream); Defination :- fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s.  Reading  stops  after an … Continue reading

Posted in Data Structures with C | Tagged , , | Leave a comment

Bubble sorting using function

#include<stdio.h> //Program for Bubble Sorting int * bubblesort(int*,int); int display(int *,int); int main() { int i,j,a[100],N,temp; printf(“Enter no.of elements you want to sort:\t”); scanf(“%d”,&N);//Max. no. of elements printf(“Enter %d elements you want to sort:\n”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore sorting:\t”); display(a,N); //Sorting … Continue reading

Posted in Data Structures with C | Tagged , , , , , , | Leave a comment

Basic linklist operations

RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict a: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1;    selected revisions: 1 description: stdio.h and stdlib.h are added. —————————- revision 1.1    locked by: a; date: 2015/07/02 … Continue reading

Posted in Data Structures with C | Tagged , , , , , , , , | Leave a comment

How to Send a signal -Using Kill command

Send a signal by Kill command ======================= – To send a signal to a process other than current task. – It has prototype :- int kill(pid_t pid, int signo); – It is included using header :- #include<signal.h> – The system … Continue reading

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , , , , | Leave a comment

How to register a signal

Register a signal ================== – Program can handle a signal using signal library function signal(). – signal() is used to register the signal handler function with kernel on behalf of current process. – It is included in header :- #include<header.h> … Continue reading

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , , , | Leave a comment

About Signals

Signals ======== – A signal is an event generated by UNIX/LINUX system in response to some condition. – On receipt of a signal, process may in turn take some action. – Signals are generated by some error conditions such as:- … Continue reading

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , | Leave a comment

Replacing a Process Image

Replacing a Process Image ========================= – The exec function replaces current process with a new process. – The path of new process is specified as argument to exec. – It is defined in header : #include<unistd.h> – Last argument of … Continue reading

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , , , | Leave a comment

Orphan Process

Orphan Process =============== If in a process, the parent process is terminated before the child process, the child process become orphan – It takes the lowest possible process as its parent – And its PPID is changed to the PID … Continue reading

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , | Leave a comment

Zombie or Defunct Process

Zombie or Defunct Process ========================== If a child proces tries to teminate,its association with parent remains until the parent terminates normally or calls wait. – The child process entry in process table is therfore not freed up immediately. – Althougth … Continue reading

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , , | Leave a comment

waiting for a process

Waiting For a Process ===================== – Sometime we would like to find out when a child process has finished. – It is needed for parent process to wait until the child finishes before continuing by calling wait. – It has … Continue reading

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , | Leave a comment

Process Duplication using fork

Process Duplication using system call fork ============================== – A new process is created using fork(). – fork() is a system call. – fork duplicates the current process. – It creates a new entry in the process table with many of … Continue reading

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , | Leave a comment

Multiple Data Compressions And Encription Using Iterative Technique

Logfile of compleated Project ————————————————— ————————————————— RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1;    selected revisions: 1 description: It includes basic headers which are used … Continue reading

Posted in Data Structures with C, Project 2: Multiple Data Compression and Encryption | Tagged , , , , , , , , , , | Leave a comment

Selection Sorting in C

#include<stdio.h> //Program for Selection Sorting int main() { int i,j,a[100],N,temp; printf(“Enter no.of elements you want to sort:\t”); scanf(“%d”,&N);//max no. of elements printf(“Enter %d elements you want to sort:\n”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore sorting:\t”); for(i=0;i<N;i++) printf(“%d\t”,*(a+i)); //Sorting Starts for(i=0;i<N-1;i++) for(j=i+1;j<N;j++) if(a[i]>a[j]) { … Continue reading

Posted in Data Structures with C | Tagged , , , , , | Leave a comment

Bubble Sorting in C

#include<stdio.h> //Program for Bubble Sorting int main() { int i,j,a[100],N,temp; printf(“Enter no.of elements you want to sort:\t”); scanf(“%d”,&N);//Max. no. of elements printf(“Enter %d elements you want to sort:\n”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore sorting:\t”); for(i=0;i<N;i++) printf(“%d\t”,*(a+i)); //Sorting Starts for(i=0;i<N-1;i++) for(j=0;j<N-i-1;j++) if(a[j]>a[j+1]) { … Continue reading

Posted in Data Structures with C | Tagged , , , , | Leave a comment