Values are not written to the file. Why? C++?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
8 views
Written only a comma.
Divide all as needed library, which will receive the data and write files of a certain structure. Maybe it's completely the wrong approach?

I'm learning, maybe a stupid question

main.cpp
#include "stdafx.h" #include #include #include #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(); }


function.h
struct Station { std::string station_name; std::string rec_dew; std::string year; }; void writefirstline();


function1.cpp
#include "stdafx.h" #include #include #include #include #include "function.h" using namespace std; struct Station station; void writefirstline(){ ofstream file("fileConfiguration.cfg"); file<
by | 8 views

1 Answer

0 like 0 dislike
You have the station that you write, empty. It may be worth it to transfer the recorded station a parameter to a function?
Or announce station in function1.cpp as extern, the details can be read in any textbook.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
35,593 users