Thread: How do i read from ini?

  1. #16
    Registered User
    Join Date
    Aug 2001
    Posts
    411
    Ok.

    Code:
    #include <windows.h>
    #include <string>
    
    	static int INI_BUFFER_SIZE = 512;
    
    	string section = "Section Name";
    	string key = "Key Name";
    	string def = "Value if Key is not Found";
    	string file = "Path to the INI file.";
    	char* temp = new char[INI_BUFFER_SIZE];
    
    	GetPrivateProfileString( section.c_str(), key.c_str(), def.c_str(), temp, INI_BUFFER_SIZE, file.c_str());
    
    	//temp contains the value from the ini file, do something with it.
    
    	delete [] temp;
    MSDN contains a good description of the function.

    You could allways write your own text parser to read the info.

  2. #17
    Registered User
    Join Date
    Jul 2004
    Posts
    19
    thanks a ton Eber Kain!

  3. #18
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309
    Quote Originally Posted by GuardianBarak
    im making a bot for a game i play and i need the thing to read the ini file and get the AccountName then put it in then get AccountPass and put it in then the CharacterLocation..
    Is this by any chance for Diablo II? (sorry for the off-topic post) If it is I think root's bot is open source now (I could be wrong) - have a look at that.

  4. #19
    Registered User
    Join Date
    Jul 2004
    Posts
    19
    yeah its for diablo ii ill go have a look at it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What Would You Use To Read User Input?
    By djwicks in forum C Programming
    Replies: 11
    Last Post: 04-05-2005, 03:32 PM
  2. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  3. I am lost on how to read from file and output to file?
    By vicvic2477 in forum C++ Programming
    Replies: 4
    Last Post: 02-27-2005, 11:52 AM
  4. Read Array pro!!Plz help!!
    By Supra in forum C Programming
    Replies: 2
    Last Post: 03-04-2002, 03:49 PM
  5. Help! Can't read decimal number
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 09-07-2001, 02:09 AM