Hi, this is my first time posting here and was hoping someone could help me.
So basically it's a problem with types I think, here is the code:
In file.txt theres a list of words likeCode:LPSTR Array[]; BOOL File2Array(LPSTR pArray[], char *szFile) { int i = 0; std::ifstream file(szFile); if (file.is_open()) { std::string line; while(std::getline(file, line)) { pArray[i] = mysprintf("%s", line.c_str()); i++; if(i > 500) return TRUE; } } else { Print("Unable to open file."); return FALSE; } return TRUE; } File2Array(Array, "file.txt");
apple
orange
pear
banana
etc
it populates the array fine, and if I do this:
it prints it prints them all fine, but if i want to do, say, this:Code:for(int i = 0; i < 10; i++) cout << Array[i];
I crash..Code:BOOL IsListed(char *szWord) { for(int i = 0; _strcmpi(Array[i], "(null)") != 0 && i < 500; i++) if(!_strcmpi(Array[i], szWord)) return TRUE; return FALSE; } char szWord[0x10]; strcpy(szWord, "apple"); IsListed(Word);
This is a dll too, it's a hack for a game.. honestly this is kind of out of my knowledge of c++, but I practically have it working and wrote most of it, so I wish I could get it working..
Thanks,
Vivec45



LinkBack URL
About LinkBacks



