I posted this problem in another post but seeing how that was for a different problem and I'd already been given a solution I thought I'd make a new post.
For some reason, I cannot add string literals using the + operator. I've tried tons of different functions such as copy(), strcat(), etc. BUT every friggin time, it either gives me error C2110 or it compiles and gives me a unreadable figure. I've tried conversions, I've tried everything that I know including 3 different compilers (Borland, VC, GNU GCC).
Would someone please find my dunce mistake so I can get on with my coding self?
If you need the compilable code please ask.
Code:
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
char getGrid()
{
char grid[6][6];
for ( int i = 0; i < 6; i++)
{
for ( int j = 0; j < 6; j++)
{
char* szResult = new char[255];
memset(szResult, 0x00, 255);
char szKey[] = "grid[" + i + "][" + j + "]"; // WILL NOT DO WHAT I NEED.
//This isn't the only option I've tried.
//Probably something easy I'm missing...
cout << szKey << " " << i << " " << j << endl; //int i and int j have normal values.
GetPrivateProfileString("Grid", szKey, "", szResult, 255, ".\\default.ini");
grid[i][j] = (int)szResult;
}
}
return **grid;
}