From 0f360316323ca64ba1d6f7a4c1fb529c089eb37b Mon Sep 17 00:00:00 2001 From: Raghav Grover Date: Tue, 9 Oct 2018 10:31:49 +0530 Subject: [PATCH] Added a flex program to remove special characters. --- FLEX/special_char.l | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 FLEX/special_char.l diff --git a/FLEX/special_char.l b/FLEX/special_char.l new file mode 100644 index 000000000..acdff04dc --- /dev/null +++ b/FLEX/special_char.l @@ -0,0 +1,20 @@ +/* This program removes special characters from a file. It takes "spchar.txt" as input and stores the output in "wspchar.txt". */ +%{ + #include + FILE *sp,*wsp; +%} + +%% +[a-zA-Z ] {fprintf(wsp,"%s",yytext);} +. {fprintf(wsp,"");} +%% + +int main() +{ + sp=fopen("spchar.txt","r"); + wsp=fopen("wspchar.txt","w+"); + yyin=sp; + yyout=wsp; + yylex(); + return 0; +}