Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
1 vote
1 answer
53 views

I am writing a multithreaded program in which each thread opens its own text file for primitive debug logging. Each thread is represented by a separate instance of a class, which manages both the std::...
user18's user avatar
  • 331
0 votes
0 answers
72 views

I was working with Runge Kutta 4 and a quadratic friction. I was running some tests to see for which angle I would have the max range (it's Pi/4 as it would be for no friction). Anyway I got this ...
2 votes
1 answer
194 views

I have a simple class in C++20 that logs data to a file line by line for Windows platform. To ensure thread safety, I use a static std::mutex to serialize the write operations. However, I encounter an ...
2 votes
1 answer
120 views

I want to save a calculated vector of data to a file so I can load it later, avoiding the need to recalculate it every time the program starts. The issue is that this works fine with relatively small ...
1 vote
1 answer
85 views

I have created a "File" class for a C++ project of mine, and its based on ofstream. Here is the simplified code: file.h #include <fstream> #include <mutex> #include <...
2 votes
0 answers
105 views

This is a mini test. The memory used by this C++ program increases from 1KB to 10MB while writing a string to a file. It seems that ofstream didn't release its memory after append. In theory, std::...
Geoffrey's user avatar
0 votes
1 answer
112 views

Why, if you write a string containing "\r\n" to a file opened in binary mode, and then read that string from the same file, but opened in text mode, then the string will contain '\n' ...
0 votes
1 answer
81 views

I am learning C++, and have been for about 3 weeks now. Right now, I am writing a program based off of a tutorial (don't worry, I know about tutorial hell. I learned the data types and functions one ...
0 votes
1 answer
138 views

I have cpp code like this: std::ofstream fs; queue msg_queue; uint64_t write_size_in_shared_memery =0; string file_name = "1"; while(true) { buffer,buffer_size = msg_queue.pop(); if(!...
1 vote
0 answers
74 views

So I am a second year computer science student and tinkering with a personal project as a practice before our school activity. I am trying to be familiar with the fstream header. Now, I (or my ...
0 votes
1 answer
108 views

My code: int main() { string path = "D:\\myFile.txt"; Point pointOfIllusion(1, 2, 3); Point pointOfDesilusion(3, 2, 1); ofstream fout; fout.exceptions(ofstream::...
0 votes
1 answer
532 views

I am beginner in c++. trying to store data from one function to another and I have several classes and functions which are inheretance. Would appreciate if someone can explain to me how to use the ...
alson's user avatar
  • 59
3 votes
1 answer
203 views

Whenever I write the data into the file after rerunning the code the contents of the file disappears #include <iostream> #include <fstream> using namespace std; int main(){ string ...
-3 votes
1 answer
128 views

Sorry for any poor formatting - this is my first time asking a question here. I'm working on a project which involves writing some information to a file. When I run or debug the program in debug ...
0 votes
0 answers
43 views

I'm encountering an issue with writing to a file using ofstream within a C++ class. I've created a minimal example to illustrate the problem: #include <iostream> #include <fstream> class ...

15 30 50 per page
1
2 3 4 5
...
68

AltStyle によって変換されたページ (->オリジナル) /