ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/mesh/session.cpp
Revision: 3
Committed: Tue Jun 12 12:42:51 2007 UTC (17 years, 11 months ago)
File size: 2269 byte(s)
Log Message:

File Contents

# User Rev Content
1 3 //---------------------------------------------------------------------------
2     #include <vcl\vcl.h>
3     #pragma hdrstop
4     #include <process.h>
5     #include <stdio.h>
6     #include <string.h>
7     #include <dir.h>
8    
9     #include "session.h"
10     #include "fenetre.h"
11    
12     //---------------------------------------------------------------------------
13     #pragma resource "*.dfm"
14     Tcsession *csession;
15     //---------------------------------------------------------------------------
16     __fastcall Tcsession::Tcsession(TComponent* Owner)
17     : TForm(Owner)
18     {
19     }
20     //---------------------------------------------------------------------------
21     void __fastcall Tcsession::FormClose(TObject *Sender, TCloseAction &Action)
22     {
23     Action=caFree;
24     }
25     //---------------------------------------------------------------------------
26     void __fastcall Tcsession::FormCreate(TObject *Sender)
27     {
28     char mess[270];
29    
30     OpenDialog1->InitialDir=Fenp->dir_defaut;
31     if (OpenDialog1->Execute()==true)
32     {
33     strcpy(File,OpenDialog1->FileName.c_str());
34     strcpy(mess,"Session ");
35     strcat(mess,File);
36     Caption=mess;
37     }
38     csession->Font->Color=clWindowText;
39     csession->Left=0;
40     csession->Top=0;
41     }
42     //---------------------------------------------------------------------------
43     void __fastcall Tcsession::Button1Click(TObject *Sender)
44     {
45     csession->Close();
46     }
47     //---------------------------------------------------------------------------
48     void __fastcall Tcsession::Button2Click(TObject *Sender)
49     {
50     char mess[1000];
51     char arg1[255];
52     char arg2[255];
53     char arg3[255];
54     char arg4[255];
55     char arg5[255];
56     char arg6[255];
57     char arg7[255];
58     char arg8[255];
59     char arg9[255];
60     char arg10[255];
61     FILE *ses;
62    
63     chdir(Fenp->home);
64     Button1->Enabled=false;
65     Button2->Enabled=false;
66     ses=fopen(File,"rt");
67     while (feof(ses)==0)
68     {
69     arg1[0]=0;arg2[0]=0;
70     fgets(mess,1000,ses);
71     if (feof(ses)==0)
72     {
73     sscanf(mess,"%s %s %s %s %s %s %s %s %s %s",arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
74     spawnl(P_WAIT,arg1,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,"-batch",NULL);
75     }
76     }
77     fclose(ses);
78     Label1->Caption="Session executée";
79     Button1->Enabled=true;
80     Button2->Enabled=true;
81     csession->SetFocus();
82     }
83     //---------------------------------------------------------------------------