Sunday, 16 June 2019

Write a LEX program to copy content from input file to output file.


            

               Code :

%{
#include<stdio.h>
#include<string.h>
char line[20];
FILE *out;
%}
%%
['\n'] { fprintf(out,"%s\n",line);}
(.*)  {strcpy(line,yytext);}
%%
main()
{
yyin=fopen("input.txt","r");
out=fopen("output.txt","w");
yylex();
}
int yywrap()
{
return 1;
}

No comments:

Post a Comment

It's time To increase blogging capability. To have a chance to contribute in digital world. Any Interested People who want to make t...