title: Flex/Lex reading from a input file
body: <p>I have a Lex program that reads if a given character is an alphabet or number. How to I take my inputs directly from a file. This is my simple program. Also what would be a good tutorial for Flex/Lex</p>
  
  <pre><code>%{
  #include&lt;stdio.h&gt;
  %}
  
  %%
  
  [a-zA-Z]+   printf("Token Type: STRINGLITERAL \n Value: [%s] ",yytext);
  [0-9]+ printf("Token Type: INTLITERAL \n VALUE:[%s]", yytext);
  
  .   printf("[%s] is not a word",yytext);
  
  
  %%
  
  int main(void)
  {
      yylex();
      return 0;
  }
  </code></pre>