Questions tagged [file-io]

File I/O is input/output that involves the file system. This could include performing operations on directories and files, such as creation and deletion, reading files, and writing output to files.

For an introduction on File I/O in C, see C Programming / File I/O on Wikibooks.

21104 questions
8
votes
5 answers

fopen without fclose in C

What happens if i open a file using fopen some n number of times without calling fclose on it? Any buffer overrun issues may arise?
chaitanyavarma
  • 315
  • 2
  • 4
  • 8
8
votes
2 answers

ReplaceFile alternative when application keeps file locked

Editor FooEdit (let's call it) uses ReplaceFile() when saving to ensure that the save operation is effectively atomic, and that if anything goes wrong then the original file on disc is preserved. (The other important benefit of ReplaceFile() is…
Ian Goldby
  • 5,609
  • 1
  • 45
  • 81
8
votes
1 answer

subscripting a specific line from python's csv reader?

i'd like to be able to access specific lines of a csv file through the csv reader. For example, the fourth line. Is there a way to do this with python's csv reader module?
ahhh
  • 123
  • 1
  • 2
  • 5
8
votes
1 answer

If I truncate a file to zero in Python 3 do I also need to seek to position zero?

According to the answers from this question calling truncate does not actually move the position of a file. So my question is, if I truncate a file to length zero after I read something from it (because I want to write from the beginning) should I /…
Startec
  • 12,496
  • 23
  • 93
  • 160
8
votes
1 answer

Download and write a file with Retrofit and RxJava

I'm downloading a pdf file with retrofit, the way that i'm downloading it is by blocks. I use the Content-Range header to obtain a range of bytes, then i need to write these bytes on a file the problem is the order to write them. I'm using the…
Silmood
  • 218
  • 1
  • 3
  • 11
8
votes
2 answers

Reading strings into Matlab from excel?

I would like to read strings into Matlab from an excel file ID = xlsread('data.xlsx',1, 'D2:D4') the cells in range D2:D4 have strings in them. When I try to import the strings into Matlab all I get is an empty list? what can I do to fix this?
Ben Fossen
  • 1,331
  • 6
  • 21
  • 33
8
votes
3 answers

Node.js v0.10: Replace certain bytes in file without reading whole file

I am making a text editor and for editing a file I really need some sort of way to only read certain bytes from a file, which I've achieved using fs.createReadStream uisng the start and end options. I also need to replace certain bytes in the file.…
greduan
  • 4,770
  • 6
  • 45
  • 73
8
votes
2 answers

c - Usage of F_GETFL and F_SETFL

While trying to use fcntl() with command F_GETFL and F_SETFL, I got some questions: Why the flag returned by fcntl(fd, F_GETFL) only include a subset of bits of what I set when open file? Does it only show the ones that are modifiable? When use…
Eric
  • 22,183
  • 20
  • 145
  • 196
8
votes
1 answer

window.resolveLocalFileSystemURI is not a function

I created a web application that I need to convert to a mobile application, now all I have is html5/js/css files which means I don't have any www foder no platforms folder, not a cordova project ... I started first to build the app using cordova…
Khalid
  • 4,730
  • 5
  • 27
  • 50
8
votes
1 answer

Take file contents and put it into a string in C++

I'm using OpenGL and I need the contents of VertexShader.glsl to be put into a std::string I've looked at the related StackOverflow posts about this but I don't really know how to match together data types and stuff to make it work. Take for example…
Brady Dean
  • 3,378
  • 5
  • 24
  • 50
8
votes
3 answers

Reading in parts of file, stopping and starting with certain words

I'm using python 2.7, and I have been assigned (self-directed assignment, I wrote these instructions) to write a small static html generator, and I would like assistance finding new-to-python oriented resources for reading portions of files at a…
NMacKenzie
  • 81
  • 5
8
votes
7 answers

How can I read data from a text file using VB6?

I need to read data from text files and use the same in my application. Im using VB 6.0. What commands do I use? Some Sample code would be highly appreciated.
Jack Njiri
  • 346
  • 1
  • 5
  • 12
8
votes
2 answers

How to open and read LZMA file in-memory

I have a giant file, let's call it one-csv-file.xz. It is an XZ-compressed CSV file. How can I open and parse through the file without first decompressing it to disk? What if the file is, for example, 100 GB? Python cannot read all of that into…
Totes McGoats
  • 111
  • 1
  • 3
8
votes
1 answer

How to Read and Write data to a text file in Swift using playground?

I read through these SO links for the answer 1. Read a file/URL line-by-line in Swift 2. Read and write data from text file Link 2 Provided me the solution but the problem is directory. It is by default Document directory of the current project. So…
iamprem
  • 606
  • 2
  • 9
  • 23
8
votes
4 answers

how to read multiple dictionaries from a file in python?

I am relatively new to python. I am trying to read an ascii file with multiple dictionaries in it. The file has the following format. {Key1: value1 key2: value2 ... } {Key1: value1 key2: value2 ... } { ... Every dictionary in the file is a…
Rahul
  • 442
  • 6
  • 17
1 2 3
99
100