| CODE |
| // winformsapp.cpp : main project file. #include "stdafx.h" #include "Form1.h" #include "CIniReader.h" using namespace winformsapp; [STAThreadAttribute] int main(array<System::String ^> ^args) { // Enabling Windows XP visual effects before any controls are created Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); // Create the main window and run it Application::Run(gcnew Form1()); CIniReader m_IniReader; m_strINIFile = ".\backset.ini"; m_IniReader.setINIFileName (m_strINIFile); return 0; } |
| CODE |
| #pragma once // // CIniReader- Header File // class CIniReader { public: // method to set INI file name, if not already specified void setINIFileName(CString strINIFile); // methods to return the lists of section data and section names CStringList* getSectionData(CString strSection); CStringList* getSectionNames(); // check whether the section exists in the file BOOL sectionExists(CString strSection); // updates the key value, if key already exists, // else creates a key-value pair long setKey(CString strValue, CString strKey, CString strSection); // give the key value for the specified key of a section CString getKeyValue(CString strKey,CString strSection); // default constructor CIniReader() { m_sectionList = new CStringList(); m_sectionDataList = new CStringList(); } CIniReader(CString strFile) { m_strFileName = strFile; m_sectionList = new CStringList(); m_sectionDataList = new CStringList(); } ~CIniReader() { delete m_sectionList; delete m_sectionDataList; } private: // lists to keep sections and section data CStringList *m_sectionDataList; CStringList *m_sectionList; CString m_strSection; long m_lRetValue; // ini file name CString m_strFileName; }; |
| QUOTE |
| 1>Compiling... 1>winformsapp.cpp 1><project path hidden>\winformsapp\CIniReader.h(10) : error C2061: syntax error : identifier 'CString' 1><project path hidden>\winformsapp\CIniReader.h(13) : error C2143: syntax error : missing ';' before '*' 1><project path hidden>\winformsapp\CIniReader.h(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(13) : error C2061: syntax error : identifier 'CString' 1><project path hidden>\winformsapp\CIniReader.h(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(13) : warning C4183: 'getSectionData': missing return type; assumed to be a member function returning 'int' 1><project path hidden>\winformsapp\CIniReader.h(14) : error C2143: syntax error : missing ';' before '*' 1><project path hidden>\winformsapp\CIniReader.h(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(14) : warning C4183: 'getSectionNames': missing return type; assumed to be a member function returning 'int' 1><project path hidden>\winformsapp\CIniReader.h(17) : error C2146: syntax error : missing ';' before identifier 'sectionExists' 1><project path hidden>\winformsapp\CIniReader.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(17) : error C2061: syntax error : identifier 'CString' 1><project path hidden>\winformsapp\CIniReader.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(17) : warning C4183: 'sectionExists': missing return type; assumed to be a member function returning 'int' 1><project path hidden>\winformsapp\CIniReader.h(23) : error C2144: syntax error : 'long' should be preceded by ';' 1><project path hidden>\winformsapp\CIniReader.h(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(23) : error C2061: syntax error : identifier 'CString' 1><project path hidden>\winformsapp\CIniReader.h(27) : error C2146: syntax error : missing ';' before identifier 'getKeyValue' 1><project path hidden>\winformsapp\CIniReader.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(27) : error C2061: syntax error : identifier 'CString' 1><project path hidden>\winformsapp\CIniReader.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(27) : warning C4183: 'getKeyValue': missing return type; assumed to be a member function returning 'int' 1><project path hidden>\winformsapp\CIniReader.h(36) : error C2146: syntax error : missing ')' before identifier 'strFile' 1><project path hidden>\winformsapp\CIniReader.h(36) : error C2146: syntax error : missing ';' before identifier 'strFile' 1><project path hidden>\winformsapp\CIniReader.h(36) : error C2460: 'CIniReader::CString' : uses 'CIniReader', which is being defined 1><project path hidden>\winformsapp\CIniReader.h(7) : see declaration of 'CIniReader' 1><project path hidden>\winformsapp\CIniReader.h(36) : error C2059: syntax error : ')' 1><project path hidden>\winformsapp\CIniReader.h(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(36) : error C2473: 'strFile' : looks like a function definition, but there is no parameter list. 1><project path hidden>\winformsapp\CIniReader.h(38) : error C2065: 'strFile' : undeclared identifier 1><project path hidden>\winformsapp\CIniReader.h(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(38) : error C2864: 'CIniReader::m_strFileName' : only static const integral data members can be initialized within a class 1><project path hidden>\winformsapp\CIniReader.h(39) : error C2061: syntax error : identifier 'CStringList' 1><project path hidden>\winformsapp\CIniReader.h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(39) : error C2864: 'CIniReader::m_sectionList' : only static const integral data members can be initialized within a class 1><project path hidden>\winformsapp\CIniReader.h(40) : error C2061: syntax error : identifier 'CStringList' 1><project path hidden>\winformsapp\CIniReader.h(40) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(40) : error C2864: 'CIniReader::m_sectionDataList' : only static const integral data members can be initialized within a class 1><project path hidden>\winformsapp\CIniReader.h(43) : error C2588: '::~CIniReader' : illegal global destructor 1><project path hidden>\winformsapp\CIniReader.h(45) : error C2065: 'm_sectionList' : undeclared identifier 1><project path hidden>\winformsapp\CIniReader.h(45) : error C2541: 'delete' : cannot delete objects that are not pointers 1><project path hidden>\winformsapp\CIniReader.h(46) : error C2065: 'm_sectionDataList' : undeclared identifier 1><project path hidden>\winformsapp\CIniReader.h(46) : error C2541: 'delete' : cannot delete objects that are not pointers 1><project path hidden>\winformsapp\CIniReader.h(32) : error C2061: syntax error : identifier 'CStringList' 1><project path hidden>\winformsapp\CIniReader.h(33) : error C2061: syntax error : identifier 'CStringList' 1><project path hidden>\winformsapp\CIniReader.h(51) : error C2143: syntax error : missing ';' before '*' 1><project path hidden>\winformsapp\CIniReader.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(51) : error C2040: 'm_sectionDataList' : 'int *' differs in levels of indirection from ''unknown-type'' 1><project path hidden>\winformsapp\CIniReader.h(52) : error C2143: syntax error : missing ';' before '*' 1><project path hidden>\winformsapp\CIniReader.h(52) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(52) : error C2086: 'int CStringList' : redefinition 1><project path hidden>\winformsapp\CIniReader.h(51) : see declaration of 'CStringList' 1><project path hidden>\winformsapp\CIniReader.h(52) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(52) : error C2040: 'm_sectionList' : 'int *' differs in levels of indirection from ''unknown-type'' 1><project path hidden>\winformsapp\CIniReader.h(54) : error C2146: syntax error : missing ';' before identifier 'm_strSection' 1><project path hidden>\winformsapp\CIniReader.h(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(58) : error C2146: syntax error : missing ';' before identifier 'm_strFileName' 1><project path hidden>\winformsapp\CIniReader.h(58) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(58) : error C2086: 'int CString' : redefinition 1><project path hidden>\winformsapp\CIniReader.h(54) : see declaration of 'CString' 1><project path hidden>\winformsapp\CIniReader.h(58) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1><project path hidden>\winformsapp\CIniReader.h(59) : error C2059: syntax error : '}' 1><project path hidden>\winformsapp\CIniReader.h(59) : error C2143: syntax error : missing ';' before '}' 1><project path hidden>\winformsapp\CIniReader.h(59) : error C2059: syntax error : '}' 1>.\winformsapp.cpp(21) : error C2146: syntax error : missing ';' before identifier 'm_IniReader' 1>.\winformsapp.cpp(21) : warning C4551: function call missing argument list 1>.\winformsapp.cpp(21) : error C2065: 'm_IniReader' : undeclared identifier 1>.\winformsapp.cpp(22) : error C2065: 'm_strINIFile' : undeclared identifier 1>.\winformsapp.cpp(23) : error C2228: left of '.setINIFileName' must have class/struct/union 1> type is ''unknown-type'' |