Answer the question
In order to leave comments, you need to log in
The values are not written to the file. Why? c++?
Only commas are written.
I share everything, because I need a library that will receive data and write files of a certain structure. Could this be the wrong approach?
I'm learning, maybe a stupid question
main.cpp
#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
#include "function.h"
using namespace std;
int main()
{
struct Station st_ation;
st_ation.station_name="Station name";
st_ation.rec_dew="1";
st_ation.year="2001";
writefirstline();
}
struct Station
{
std::string station_name;
std::string rec_dew;
std::string year;
};
void writefirstline();
#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include "function.h"
using namespace std;
struct Station station;
void writefirstline(){
ofstream file("fileConfiguration.cfg");
file<<station.station_name<<","<<station.rec_dew<<","<<station.year<<"\n";
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question