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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
// wh_signs.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "wh_signs.h"
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here
void SearchIP();
for(int j=0; j<MAX_SIGNS; j++)
{
signs[j] = NULL;
}
string strFileName = "c:\\orant\\logs\\signsreseaux.ini";
ifstream file;
file.open(strFileName.c_str());
if (file.is_open())
{
string ligne;
char IP[2];
char No[3];
char magasin[13];
char couleur[2];
char style[2];
int i = 0;
while (getline(file, ligne, '#'))
{
strncpy( IP, ligne.c_str(), 2 );
file.getline(No, 3, '#');
file.getline(magasin, 13, '#');
file.getline(couleur, 2, '#');
file.getline(style, 2, '\n');
signs[i] = new Sign(IP, No, magasin, couleur, style);
i++;
}
file.close();
int iMAX = i;
for (i=0; i<iMAX; i++)
{
signs[i]->SendMessage();
}
return true;
}
else
{
cout << "Impossible d'ouvrir le fichier.\n";
return false;
}
}
return nRetCode;
} |
Partager