Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^4: Reading a huge input line in parts

by kroach (Pilgrim)
on May 05, 2015 at 20:32 UTC ( #1125764=note: print w/replies, xml ) Need Help??


in reply to Re^3: Reading a huge input line in parts
in thread Reading a huge input line in parts

That's actually a very good idea, haven't thought about this approach.
  • Comment on Re^4: Reading a huge input line in parts

Replies are listed 'Best First'.
Re^5: Reading a huge input line in parts
by Anonymous Monk on May 05, 2015 at 21:48 UTC

    You can also use flex to make a scanner with very little fuss. For example:

    %{ void process(char *tok); %} %option noyywrap %% [0-9]+ process(yytext); [ \t\n]+ /* ignore */ . /* printf("Bad input character: %s\n", yytext); */ %% void process(char *tok) { printf("%d\n", atoi(tok)); } int main(int argc, char **argv) { yyin = stdin; if (argc > 1) yyin = fopen(argv[1], "r"); return yylex(); }

    Just run it through flex and compile the generated lex.yy.c.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1125764]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2020-10-29 03:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (268 votes). Check out past polls.

    Notices?