Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Reading textfile and placing values to a DWORD array ???

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
rod143
How do I cheat?
Reputation: 0

Joined: 15 Sep 2009
Posts: 5

PostPosted: Wed Aug 25, 2010 9:10 pm    Post subject: Reading textfile and placing values to a DWORD array ??? Reply with quote

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
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Aug 25, 2010 9:41 pm    Post subject: Reply with quote

don't create massive arrays like that, allocate the memory yourself.

you can use a stringstream for the conversion
Back to top
View user's profile Send private message
rod143
How do I cheat?
Reputation: 0

Joined: 15 Sep 2009
Posts: 5

PostPosted: Wed Aug 25, 2010 10:33 pm    Post subject: Reply with quote

NVM i got it now thanks a lot
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites