fstream Questions
1
Solved
Executing the following code
#include <iostream>
#include <fstream>
int main() {
std::fstream fs{"/dev/shm/test.bin", std::ios::in | std::ios::out | std::ios::binary | std::...
4
I want to create an empty file in ubuntu with c++ and i tried many ways and it keeps failing and show this error
error: no matching function to 'std::basic_ofstream::open(std::cxxll::...
my c...
1
Q: Is there a way to speed up clang++ STD Library fstreams? (And does anybody know why it is so much slower than g++?)
I am trying to process very large (many GBs) binary data files and was surpri...
Fateful asked 27/7, 2016 at 22:51
3
Solved
I am trying to use std::fstream for io to file, and I want to create the file if it doesn't already exist.
std::fstream my_stream
my_stream.open("my_file_name",std::fstream::binary | std::fstrea...
13
Solved
I'm working on a program that will be processing files that could potentially be 100GB or more in size. The files contain sets of variable length records. I've got a first implementation up and run...
7
Solved
What's the difference between ios::ate and ios:app when writing to a file.
In my view, ios::app gives you the ability to move around in the file, whereas with ios::ate it can only read/write at the...
9
Solved
9
Solved
2
Solved
I am currently working a project where I have a large text file (15+ GB) and I'm trying to run a function on each line of the file. In order to speed the task along, I am creating 4 threads and att...
River asked 1/12, 2016 at 7:9
6
I'm using C++ fstream to read a config file.
#include <fstream>
std::ifstream my_file(my_filename);
Right now, if I pass the path of a directory, it silently ignores this. E.g. my_file.goo...
5
Solved
This is a simple and complex question at the same time.
This compiles:
int Test;
vector<int> TEST;
TEST.push_back(Test);
cout << TEST.size();
This does not compile:
fstream Test;
v...
Kaiserslautern asked 27/3, 2012 at 12:7
6
Solved
I'm trying to move from stdio to iostream, which is proving very difficult. I've got the basics of loading a file and closing them, but I really don't have a clue as to what a stream even is yet, o...
5
If I open a text file using fstream is there a simple way to jump to a specific line, such as line 8?
8
Solved
I'm basically looking for a C++ version of fdopen(). I did a bit of research on this and it is one of those things that seems like it should be easy, but turns out to be very complicated. Am I miss...
Alyse asked 30/4, 2010 at 16:43
3
Solved
I'm writing and reading binary data (std::ios::binary) in C++ using std::fstream - this includes integer and floating point values. While my code works on my own architecture, I wan't to make sure,...
Countersignature asked 3/3, 2016 at 5:19
5
Solved
This recently asked question has raised another interesting issue, as discussed in the comments to one of its answers.
To summarize: the OP there was having issues with code like that below, when ...
Guild asked 4/1, 2020 at 8:34
5
Solved
I was reading the cplusplus.com tutorial on I/O. At the end, it says fstream buffers are synchronized with the file on disc
Explicitly, with manipulators: When certain manipulators are used on
str...
7
Solved
I have googled this, but I am still confused about how to use it. I am making a file manager, and I want to be able t o copy and paste a file into a new directory. I know to copy I need to use file...
8
Solved
Do I always have to specify absolute path for objects instantiated from std::fstream class? In other words, is there a way to specify just relative path to them such as project path?
Beachlamar asked 9/11, 2011 at 17:21
5
Solved
Check this program
ifstream filein("Hey.txt");
filein.getline(line,99);
cout<<line<<endl;
filein.getline(line,99);
cout<<line<<endl;
filein.close();
The file Hey.txt has ...
6
Solved
I'm sure I've just missed this in the manual, but how do you determine the size of a file (in bytes) using C++'s istream class from the fstream header?
5
Solved
Does anyone know why the file isn't opening? I also tried just putting "infile.txt" and placing it in the folder of the program and also the debug folder but the ways I used to check for open error...
5
I am programming on C++. In my code I create a text file, write data to the file and reading from the file using stream, after I finish the sequence I desire I wish to clear all the data inside the...
8
Solved
3
Solved
Is it possible to delete N bytes from the end of a binary file in C++ using fstream (or something similar)? I don´t want to read the whole file, cut it and write it again, but since it´s from the e...
1 Next >
© 2022 - 2025 — McMap. All rights reserved.