Hack Forums
[C] How to Read a config.ini - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] How to Read a config.ini (/showthread.php?tid=4987328)



How to Read a config.ini - Jesse Pinkman. - Sep 14, 2015

hey guys, i want my program to read a config file. i have gotten it to make a config.ini and put code inside of it
Code:
Code
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
    int Delay = 0;
    int Overshoot = 0;
    int Cooldown = 0;
   ofstream file_;
    file_.open("Config.ini");
    if(file_.is_open()){
    file_ << "Delay = \n";
    file_ << "Overshoot = \n";
    file_ << "Cooldown = \n";
     }
    file_.close();
So in the config to ini you type
Delay = 22
How do i make that change int Delay to 22?
Thanks for your time :)


* - Jesse Pinkman. - Sep 14, 2015

(Sep 14, 2015 03:54 AM)Yani Wrote:  Here's a little class you can use:
http://www.codeproject.com/Articles/8342/CIniFile-Class-for-C-A-robust-cross-platform-INI-f

Thanks man! I'm new to coding just learned the basics . Sorry if it was a dumb questions


* - Jesse Pinkman. - Sep 14, 2015

(Sep 14, 2015 03:54 AM)Yani Wrote:  Here's a little class you can use:
http://www.codeproject.com/Articles/8342/CIniFile-Class-for-C-A-robust-cross-platform-INI-f

Thanks man! I'm new to coding just learned the basics . Sorry if it was a dumb questions


* - Jesse Pinkman. - Sep 14, 2015

(Sep 14, 2015 03:54 AM)Yani Wrote:  Here's a little class you can use:
http://www.codeproject.com/Articles/8342/CIniFile-Class-for-C-A-robust-cross-platform-INI-f

Thankyou. I'm new to coding just learnt the basics. Sorry if it's a dumb question.


* - morph - Sep 14, 2015

The triple post though..
I suggest you try to write your own simple parser if you are new though.


* - Jesse Pinkman. - Sep 14, 2015

(Sep 14, 2015 04:48 AM)Zymbiotic Wrote:  The triple post though..
I suggest you try to write your own simple parser if you are new though.

Yeah didn't mean to triple post, got bad internet aye. Aight I will try man.