rod143 How do I cheat?
Reputation: 0
Joined: 15 Sep 2009 Posts: 5
|
Posted: Wed Aug 25, 2010 9:10 pm Post subject: Reading textfile and placing values to a DWORD array ??? |
|
|
anything wrong with this code?
| Code: |
char filePath[MAX_PATH];
DWORD *IFTABLE; GetPrivateProfileStringA("IFT","path","C:\\",filePath,MAX_PATH,RodSetting);
ifstream myfile(filePath);
string ibuf;
char buf[10000];
DWORD tempArray[10000];
string line;
int linecount=0;
if (myfile.is_open()) //if the file is open
{
while (!myfile.eof())
{
getline(myfile,line);//get one line from the file
myfile>>ibuf;
strcpy(buf,ibuf.c_str());
tempArray[linecount]= strtoul(buf,0,16);
linecount++;
}
IFTABLE = new DWORD[linecount];
for (int i= 0;i<linecount;i++)
{
IFTABLE[i]= tempArray[i];
}
myfile.close();
}
|
Basically i want to read a text file that is formatted like this one
00123456 //definition
00234567 //definition 1
and i wanted 00123456 and 00234567 to be placed in a DWORD array as it is
so i could have like DWORD IFTABLE [] ={0x00123456,0x00234567}
but not static instead i have a dynamic DWORD array
|
|