MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / CFGParser

Method CFGParser

LibLemon/src/cfgparser.cpp:9–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7};
8
9CFGParser::CFGParser(const char* path){
10 cfgFile = fopen(path, "r");
11
12 if(!cfgFile){
13 printf("CFGParser: Failed to open %s!\n", path);
14 return;
15 }
16
17 fseek(cfgFile, 0, SEEK_END);
18
19 size_t cfgSize = ftell(cfgFile);
20
21 if(cfgSize <= 0x8000){
22 cfgData.resize(cfgSize);
23
24 fseek(cfgFile, 0, SEEK_SET);
25
26 fread(cfgData.data(), cfgSize, 1, cfgFile);
27 } else {
28 char buf[512];
29 while(fread(buf, 512, 1, cfgFile)){
30 cfgData.insert(cfgData.end(), buf, buf + 512);
31 }
32 }
33}
34
35CFGParser::~CFGParser(){
36 if(cfgFile){

Callers

nothing calls this directly

Calls 3

dataMethod · 0.80
insertMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected