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::...
Escudo asked 29/6, 2024 at 0:24

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...
Mccartney asked 28/8, 2017 at 15:52

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...
Cotopaxi asked 12/1, 2012 at 13:31

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...
Fracture asked 5/9, 2008 at 14:52

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...
Reinhard asked 28/4, 2012 at 1:12

9

Solved

Is there a (cross-platform) way to get a C FILE* handle from a C++ std::fstream ? The reason I ask is because my C++ library accepts fstreams and in one particular function I'd like to use a C lib...
Unfriended asked 20/9, 2008 at 21:19

9

Solved

Is there a (cross-platform) way to get a C FILE* handle from a C++ std::fstream ? The reason I ask is because my C++ library accepts fstreams and in one particular function I'd like to use a C lib...
Adamo asked 20/9, 2008 at 21:19

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...

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...
Arundinaceous asked 27/3, 2015 at 21:3

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...
Penitential asked 7/2, 2012 at 13:12

5

If I open a text file using fstream is there a simple way to jump to a specific line, such as line 8?
Elytron asked 5/3, 2011 at 23:36

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...
Divan asked 10/1, 2013 at 6:15

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...
Dipetalous asked 29/7, 2013 at 16:51

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 ...
Immediately asked 26/8, 2012 at 19:53

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?
Reggi asked 9/3, 2010 at 14:0

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...
Potluck asked 18/9, 2015 at 3:32

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...
Luxate asked 10/6, 2013 at 21:12

8

Solved

How can I count lines using the standard classes, fstream and ifstream?
Radiotransparent asked 18/6, 2010 at 20:19

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...
Gredel asked 3/2, 2014 at 14:46

© 2022 - 2025 — McMap. All rights reserved.