Wednesday, 18 December 2013

Script vs Program.

The following are the differences between scripts and programs. These differences were made by be me by referring books and internet.

click here



Saturday, 30 November 2013

LEX programming in Windows



download flex from

http://www.monmouth.com/~wstreett/lex-yacc/flex.exe

write a lex program and save it as prg1.lex
%{
  // lex program to identify a given string is NUMBER or WORD
%}

%%

[0-9]+    printf("%s is NUMBER\n",yytext);

[a-zA-Z]+ printf("%s is WORD\n",yytext);

.* printf("%s is NOT a WORD or NUMBER",yytext);
%%

main()
{
 yylex();
}

int yywrap()
{
return 1;
}

save the downloaded flex.exe and prg1.l in D:\LEX
Compile using flex:

After compiling lex file a C program file is generated in the current folder.

Again compile and run the C program using Turbo C or Dec Cpp to see the result.

Thursday, 7 November 2013

C Program to handle SIGPIPE signal


When SIGPIPE signal is generated?
Two processes can communicate through pipe. Among these two one is the sending process and other is the receiving process. The sending and receiving processes can communicate through pipe as long as long as both processes are running at a time. The SIGPIPE signal is issued to the sending process when receiving process is terminated.

Here are C programs which will create Sending and Receiving processes.

writer.c(sending process)
https://docs.google.com/file/d/0B-V2GHdE2XghdWtuTzhQemI0R2M/edit?usp=drive_web

reader.c(receiving process)
https://docs.google.com/file/d/0B-V2GHdE2XghQzlMa0pfa2FxSkE/edit?usp=drive_web

compile and run these two programs in two different terminals in UNIX/LINUX environment.

To receive SIGPIPE signal by the sending process, terminate the receiving process with ctl+c or ctl+z. 

Wednesday, 28 August 2013

Linux lab manual

click here to download
download                   
or                                       
download

Saturday, 13 July 2013