PERL has spoiled me

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
I am taking CMPT 300 which is Operating Systems I. Part of our first assignment requires us to do the following :

Write a program called filter that using a function with the prototype :

void filter(int filedesc, int tab_stop)

The program will read a file and replace all '\t' instances with a number of spaces that is specified by the command line arguments.
you are only allowed to use the system calls read(),open(),close(), you cannot use fopen() or any other iostream.h functions

In PERL I could have done this in 2 seconds :p. Right now I have no error checking, and I am handling my own buffer space! I think
I like C programming :)
 

MSantiago

Senior member
Aug 7, 2002
308
0
86
Perl regular expressions are totally helpful. :D I know that they're limiting your options with the project you're doing now, but if you ever have another C/C++ project where regular expressions would come in handy, take a look at FLEX and BISON (Lex and YACC are the GNU versions under the GPL). FLEX is a lexical analyzer and BISON translates the FLEX code into a C parser. It seems cumbersome, but it's actually pretty awesome.
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
Originally posted by: MSantiago
Perl regular expressions are totally helpful. :D I know that they're limiting your options with the project you're doing now, but if you ever have another C/C++ project where regular expressions would come in handy, take a look at FLEX and BISON (Lex and YACC are the GNU versions under the GPL). FLEX is a lexical analyzer and BISON translates the FLEX code into a C parser. It seems cumbersome, but it's actually pretty awesome.

Flex & Bison are EVIL. EVIL I tell ya! Once you try 'em, you never go back!