1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| void main(void)
{
char IdentifiantLigne[40]={'*'};
char Heure[20]={'H','E','U','R','E','S'};
char MaxdB[20];
char TempsDeDepassement[20]={'H','E','U','R','E','S'};
char size;
ifstream fin;
ofstream fout;
// le constructeur de ifstream permet d'ouvrir un fichier en lecture
fin.open( "Lieu1Date1.txt", ios::in );
fout.open("c:\\Program Files\\EasyPHP1-7\\www\\Nouveau dossier\\fichier2.php", ios::out);
if(!fout) {cout<<"erreur";exit(-1);};
//Début du code PHP
fout<<"<?php"<<endl;
fout<<"include ('jpgraph.php');"<<endl;
fout<<"include ('jpgraph_bar.php');"<<endl;
// ceci sert pour la 1er utilisation de MaxdB dans le code.
fout<<"$datay=array(";
do
{
fin>>IdentifiantLigne;
switch(IdentifiantLigne[1])
{
case 'E':
fin>>Heure>>MaxdB>>TempsDeDepassement;// lecture de la partie tu texte que je veux
fout<<MaxdB<<",";//ecriture de cette partie dans le code PHP
break;
}
}while(IdentifiantLigne[0]!='*');
fout<<");"<<endl;
fout<<"$datax=array( // Ici je voudrais pour re-utiliser la variable MaxdB );";
// Setup the graph.
fout<<"$graph = new Graph(400,200,'auto');"<<endl;
fout<<"$graph->img->SetMargin(60,20,30,50);"<<endl;
fout<<"$graph->SetScale('textlin');"<<endl;
fout<<"$graph->SetMarginColor('lightblue');"<<endl;
fout<<"$graph->SetShadow();";
// Set up the title for the graph
fout<<"$graph->title->Set('Bar gradient (Left reflection)');"<<endl;
fout<<"$graph->title->SetFont(FF_VERDANA,FS_NORMAL,12);"<<endl;
fout<<"$graph->title->SetColor('darkred');"<<endl; |
Partager