Ecrire Input File pour Flex

Fermé
zitou20 Messages postés 9 Date d'inscription vendredi 21 novembre 2014 Statut Membre Dernière intervention 26 novembre 2014 - 21 nov. 2014 à 17:24
zitou20 Messages postés 9 Date d'inscription vendredi 21 novembre 2014 Statut Membre Dernière intervention 26 novembre 2014 - 22 nov. 2014 à 11:07
Bonjour,
j'ai jamais utilisé Flex.J'ai téléchargé Flex à partir de ce lien https://sourceforge.net/projects/flex/files/ et je veut écrire ce code comme un exemple ,où je doit l'écrire ?
/*
* Sample Scanner1:
* Description: Replace the string "username" from standard input
* with the user's login name (e.g. lgao)
* Usage: (1) $ flex sample1.lex
* (2) $ gcc lex.yy.c -lfl
* (3) $ ./a.out
* stdin> username
* stdin> Ctrl-D
* Question: What is the purpose of '%{' and '%}'?
* What else could be included in this section?
*/

%{
/* need this for the call to getlogin() below */
#include <unistd.h>
%}

%%
username printf("%s\n", getlogin());
%%

main()
{
yylex();
}
A voir également:

2 réponses

mousekey Messages postés 68 Date d'inscription dimanche 13 février 2005 Statut Membre Dernière intervention 22 novembre 2014 4
22 nov. 2014 à 02:04
0
zitou20 Messages postés 9 Date d'inscription vendredi 21 novembre 2014 Statut Membre Dernière intervention 26 novembre 2014
22 nov. 2014 à 11:07
Merci pour votre réponse :)
0