Questions tagged [file-handling]

file-handling is an abstraction of common actions such as creating, opening, closing, reading, updating, writing, comparing and deleting files

2915 questions
7
votes
3 answers

Processing large files in chunks: inconsistent seek with readline

I am trying to read and process a large file in chunks with Python. I am following this blog that proposes a very fast way of reading and processing large chunks of data spread over multiple processes. I have only slightly updated the existing code,…
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
7
votes
1 answer

Are interrupt signals dispatched during fread() and fwrite() library calls?

On Linux, the C standard library calls fread and fwrite execute the system call equivalents, read and write. The man pages for the system calls mention interrupts, saying that a short write may occur with errno set to EINTR. However, the man pages…
magnus
  • 4,031
  • 7
  • 26
  • 48
7
votes
1 answer

Long path \\?\ workaround not working on some installs

The app I'm working on needs to handle files with very long file/path names. It's a .Net 4.6 application so I've implemented the pre-4.6.2 workaround to allow the \\?\ syntax as outlined here and here. This is the code I'm using to enable the…
technophebe
  • 494
  • 3
  • 13
7
votes
2 answers

Swift 4 macOS App - How to find the important users directories?

What is the easiest way with Swift 4 for a macOS application to find the important users directories like: Desktop, Documents, Downloads etc.?
7
votes
2 answers

Default mode of fstream

I was looking at the SO post C++ file stream open modes ambiguity. I wanted to know the default file opening mode of fstream. One of the answer says, What the above implies is that the following code opens the file with exactly the same open…
Rajesh
  • 1,085
  • 1
  • 12
  • 25
7
votes
1 answer

Difference between std::remove and boost::filesystem::remove?

In the C++17 filesystem library, we got std::filesystem::remove(path), which — as I understand it — is a direct port of boost::filesystem::remove(path) from Boost.Filesystem. But C++ inherited from C89 a very similar function called…
Quuxplusone
  • 23,928
  • 8
  • 94
  • 159
7
votes
3 answers

Reading and writing to a file at the same time in C

Supposed to swap every two lines in a file until just one line remains or all lines are exhausted. I don't want to use another file in doing so. Here's my code: #include int main() { FILE *fp = fopen("this.txt", "r+"); int i = 0; …
ps_
  • 97
  • 2
  • 12
7
votes
5 answers

Get all files modified in last 7 days in a directory in Java

I want to get the files which are modified in last 7 days using Java. Once I get the files I need it for other file operations. Right now I am able to get all files from the directory and perform my file operations. Please suggest me how to get the…
Krishna
  • 65
  • 1
  • 6
7
votes
4 answers

Nodejs Read very large file(~10GB), Process line by line then write to other file

I have a 10 GB log file in a particular format, I want to process this file line by line and then write the output to other file after applying some transformations. I am using node for this operation. Though this method is fine but it takes a hell…
HVT7
  • 709
  • 4
  • 13
  • 23
7
votes
4 answers

Read contents of a file as hex in C

I have a file with hex values saved as hex.txt which has 9d ff d5 3c 06 7c 0a Now I need to convert it to a character array as unsigned char hex[] = {0x9d,0xff,0xd5,0x3c,0x06,0x7c,0x0a} How do I do it ?
vikkyhacks
  • 3,190
  • 9
  • 32
  • 47
7
votes
1 answer

Create virtual file path from stream

I have a general question concerning C# & Windows API: My task is loading a file from a document management system (DMS) and create a byte array from this file. From the developer of the DMS I got a dll which provides a method like…
marco birchler
  • 1,566
  • 2
  • 21
  • 45
6
votes
4 answers

How to read from a file until a character is read then skip some characters and continue reading again

How do I read from a file till a particular character is reached and then seek to the next character and continue reading in C++. In my program I am using some HTML syntax and generating a .htm file... So in my C++ code I have added the tags. But…
ark
  • 167
  • 1
  • 1
  • 14
6
votes
4 answers

Most efficient way of reading file

I have a file which contains a certain number of fixed length rows having some numbers. I need to read each row in order to get that number and process them and write to a file. Since I need to read each row, as the number of rows increases it…
Jay
  • 373
  • 8
  • 22
6
votes
2 answers

Reading .dat file in python

I have a .dat file which I don't have any idea about how it was created and what delimiter was used and any details about it. I just have its corresponding mdf and csv file. Thats all. Is there any way in python to read this .dat file? Few ways that…
user11247278
6
votes
2 answers

Where can I find the MyDocuments folder on iPhone Simulator?

I created a text file named Write.txt in the Documents folder in a Xamarin.iOS app. After that I was able to read its content to the console. var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var filename =…
kistelekig
  • 165
  • 1
  • 6