This is my main method:
#include <string>
#include <fstream>
#include <streambuf>
#include <iostream>
#include <cstdlib>
#include "json.h"
using namespace std;
int main () {
ifstream infile;
infile.open ("/Users/kbooras/Desktop/Countries.txt");
if (infile.is_open())
{
cout << "good open \n";
string inputStr((istreambuf_iterator<char>(infile)), istreambuf_iterator<char>());
json_value data = * json_parse(inputStr.c_str());
infile.close();
}
else
{
cout << "Error opening file \n";
}
return 0;
}
The program builds successfully but I keep getting this error and I don't know what is going wrong:
Thread 1: EXC_BAD_ACCESS (code=1, address=0x20)
The error occurs at this line:
json_value data = * json_parse(inputStr.c_str());
And I get the output:
good open
(lldb)
Could someone please help me figure this out? Thanks!

New Topic/Question
Reply



MultiQuote


|