Bonjour,
j'ai un soucis pour appeler ma fonction SearchIP(), je l'ai déclaré dans la classe Sign dans ce fichier vu en dessous:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
// Sign.h: interface for the Sign class.
//
//////////////////////////////////////////////////////////////////////
 
#if !defined(AFX_SIGN_H__A98506A6_558A_4D1D_A9CB_0F5468802A94__INCLUDED_)
#define AFX_SIGN_H__A98506A6_558A_4D1D_A9CB_0F5468802A94__INCLUDED_
 
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
 
#include "amscomdef.h"
#include "ezprotocoldef.h"
#include "CEZMessage.h"
#include "CEZSystemParameter.h"
using namespace std;
 
class Sign  
{
public:
	Sign();
	Sign(CString sIP, CString sID, CString sMsg, CString sColor, CString sFontWidth);
	virtual ~Sign();
	CString GetText();
	CString GetAddress();
	CString GetColor();
	CString GetFont();
	bool SendMessage();
	SIGN_STRUCT adaptive;
	SearchIP();		
private:
	string xIP[20];	
	CString sMessage;
	CString sColour;
	CString sFont;
};
 
#endif // !defined(AFX_SIGN_H__A98506A6_558A_4D1D_A9CB_0F5468802A94__INCLUDED_)
et voici la fonction SearchIP:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
// Sign.cpp: implementation of the Sign class.
//
//////////////////////////////////////////////////////////////////////
 
#include "stdafx.h"
#include "Sign.h"
 
#include <string>		
#include <iostream>		
#include <fstream>		
 
using namespace std;	
 
 
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
 
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
 
Sign::Sign()
{
}
 
Sign::~Sign()
{
}
 
Sign::SearchIP()		
{
	string strFileTemp = "c:\\orant\\logs\\IP.ini";			
	ifstream temp;
	temp.open(strFileTemp.c_str());
 
	if (temp.is_open())
	{
		string ligne;
		int i = 1;
		cout << i << endl;
		system("pause");
		while (getline(temp, ligne))					
		{
			xIP[i] = ligne.c_str();
			// test affichage
			cout << xIP[i] << endl;
			system("pause");
			i++;
		}
		temp.close();
	}
	else
	{
		cout << "Impossible d'ouvrir le fichier.\n";
	}
}
 
// suite du programme
jusque là je pense que tout va bien mais quand je veux appeler ma fonction dans le main, je tape
soit: et là j'ai droit à l'erreur undeclared identifier
soit: et là aucune erreur mais la console n'affiche pas mon cout avec la valeur de xIP[i] donc je me demande si la fonction s'exécute....

une idée?