Téléchargement
Exemple de fonction main() pour votre Analyseur Syntaxique :Version très "rustique" pour linux à modifier selon vos besoins...
/* (c) PK */ #include <stdio.h> #include <stdlib.h> #include <malloc.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include "mppksag.h" static int file_length; static char *filein = "test.in" ; static char *fileout = "test.out"; extern void mppk_start(); int main (int argc, char ** argv) { FILE *fp; struct stat statbuf; char *file_string; fp = fopen(filein,"r"); if (!fp) { fprintf(stderr,"cannot open %s\n",filein); exit(1); } if (stat(filein, &statbuf) == 0) file_length = statbuf.st_size; else file_length = 1000000; /* arbitrary file length */ file_string = (char *) malloc((unsigned)file_length+1); fread(file_string, sizeof(char), file_length, fp); file_string[file_length] = '\0'; fclose(fp); printf("%s\n",mppksag(file_string, mppk_start)); }
|
Ce Site a été mis à jour le Samedi 21 Septembre 2024 à 13:55:03 |
Page générée en 0.298 secondes !
Site généré par YAK Pro - Web Portal System v 3.0 Beta 10
© YAK Pro ® 2002-2025 - Tous Droits Réservés !