I have no clue whatsoever as to what would be doing this
#include "fstream"
#include "iostream"
using namespace std;
#define out(a) cout << #a << ": " << a << '\n'
void print(string s)
{
cout << s << '\n';
}
int main()
{
ifstream readt1;
readt1.open("test1.yaml");
while(readt1.good())
{
char cc[128];
readt1.get(cc,128);
out(cc);
}
readt1.close();
}
that code… outputs this:
cc: version: 0.14.1
cc:
with test.yaml being this
version: 0.14.1
name: scrumbleship
author: dirkson
description: >
A minecraft like game that allows you
to build your own spaceship!
I’ve tried so many ways to get this to work, and it simply doesn’t
If you add a
readt1.ignore();after the get() it should work:This fixes the immediate problem, but using
std::getlineandstd::stringwould be better C++. Something like: