I like to keep my code clean and as such, like to keep my source in source files and declarations and such in my header files, but to all avail, it always fails!
#include "ini_handler.h"
#include "StdAfx.h"
#include <string>
#include <iostream>
#include <fstream>
usingnamespace std;
// Upon constructing, read file into data value
INI::INI(string fileName)
{
char *line = newchar[100]; // Holds the file's data
ifstream file;
file.open(fileName);
if(file.is_open())
{
// Read file contents
while(!file.eof())
{
file.getline(line, 100);
data += line;
data += '\n';
}
}
delete[] line;
file.close();
}
Here's the error code:
1 2 3 4 5
c:\users\zinglish\documents\visual studio 2010\projects\d3d game base\d3d game base\ini_handler.cpp(11): error C2653: 'INI' : is not a class or namespace name
c:\users\zinglish\documents\visual studio 2010\projects\d3d game base\d3d game base\ini_handler.cpp(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\zinglish\documents\visual studio 2010\projects\d3d game base\d3d game base\ini_handler.cpp(24): error C2065: 'data' : undeclared identifier
c:\users\zinglish\documents\visual studio 2010\projects\d3d game base\d3d game base\ini_handler.cpp(25): error C2065: 'data' : undeclared identifier
c:\users\zinglish\documents\visual studio 2010\projects\d3d game base\d3d game base\ini_handler.cpp(32): warning C4508: 'INI' : function should return a value; 'void'return type assumed