rename functions in read_config

This commit is contained in:
lakinduakash 2019-04-14 13:41:53 +05:30
parent 30d077deb7
commit 24862a9798
2 changed files with 7 additions and 5 deletions

View File

@ -2,19 +2,21 @@
// Created by lakinduakash on 14/04/19.
//
#include "read_config.h"
#include <iostream>
#include <fstream>
#include <algorithm>
#include "read_config.h"
#include "h_prop.h"
extern "C" {
int read_config_1() {
int read_config_file() {
// std::ifstream is RAII, i.e. no need to call close
std::ifstream cFile("/home/lakinduakash/wh.config");
std::ifstream cFile(CONFIG_FILE);
if (cFile.is_open()) {
std::string line;
while (getline(cFile, line)) {
@ -22,7 +24,7 @@ int read_config_1() {
line.end());
if (line[0] == '#' || line.empty())
continue;
auto delimiterPos = line.find("=");
auto delimiterPos = line.find('=');
auto name = line.substr(0, delimiterPos);
auto value = line.substr(delimiterPos + 1);
std::cout << name << " " << value << '\n';

View File

@ -9,7 +9,7 @@
extern "C" {
#endif
int read_config_1();
int read_config_file();
#ifdef __cplusplus
}