Questions tagged [filehandle]

A file handle is an abstract indicator for accessing a file. It is retrieved after successfully opening the file using the file name. Afterwards the file handle is used instead of the file name for all file operations.

407 questions
1
vote
2 answers

fflush fails on Visual C++ 2010

I'm trying to run some code but fflush() with the error: Invalid file descriptor. File possibly closed by a different thread Here is the relevant part of the code: fhandle = fopen("dbfile.bin", "rbc"); /* There is a valid dbfile.bin file -…
chustar
  • 12,225
  • 24
  • 81
  • 119
1
vote
0 answers

How do I release a file handle with Qt QMovie?

I have written a simple image viewer. It can view the images just fine, but when it tries to shutil.move a .gif file played with QMovie it crashes. Problem is a still open filehandle. How do I close the filehandle while still playing the gif? This…
1
vote
1 answer

How to write text file in python3.x?

I am unable to write to a text file. My function looks like this. The file is created but after running the code the file remains empty. I am unable to figure out what the problem is. def compare(prjCode, prjName, stCode, stName, dCode, dName,…
Karan Gupta
  • 529
  • 2
  • 7
  • 21
1
vote
1 answer

Does reading a binary file linewise in python cause problems for unicode data?

I'm reading a large (10Gb) bzipped file in python3, which is utf-8-encoded JSON. I only want a few of the lines though, that start with a certain set of bytes, so to save having to decode all the lines into unicode, I'm reading the file in 'rb'…
user2667066
  • 1,867
  • 2
  • 19
  • 30
1
vote
1 answer

Swift FileHandle seek/readData performance

Context: I have a project where I store a lot of data in Binary files and Data files. I retrieve offsets in a Binary file, stored as UInt64, and each of these offsets give me the position of an utf-8 encoded String in another file. I am attempting,…
Scaraux
  • 3,841
  • 4
  • 40
  • 80
1
vote
1 answer

How do I merge specific columns from files in array or hash of multiple file handles, one line at a time?

I'll start by describing the files I am working with: ./groupA ./groupA/fileA.txt ./groupA/fileB.txt ./groupA/fileC.txt ./groupA/fileD.txt ./groupB ./groupB/fileA.txt ./groupB/fileB.txt ./groupB/fileC.txt etc. Here is…
Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345
1
vote
1 answer

4-Argument-Select-Question

From SELECT_TUT: "... is used to efficiently monitor multiple file descriptors, to see if any of them is, or becomes, "ready"; that is, to see whether I/O becomes possible, or an "exceptional condition" has occurred on any of the descriptors. …
sid_com
  • 24,137
  • 26
  • 96
  • 187
1
vote
1 answer

iOS : Write ByteArray ( [Int8] ) to a file in swift 4

I am developing an application for iOS using swift 4. I need to write ByteArray [Int8] to a file in applicationSupportDirectory. And later i need to upload the file on my server to read it and do the operations. My server is on java platform. The…
sohaib karim
  • 281
  • 2
  • 12
1
vote
1 answer

Unclosed file handle when filtering file lines

I've noticed that following code snippet in Groovy lefts unclosed file handle in JVM. I cannot remove this file until GC runs and closes resource by invoking finalizer. StringWriter writer = new StringWriter() new File("file.txt").filterLine(writer)…
Michal Kordas
  • 10,475
  • 7
  • 58
  • 103
1
vote
2 answers

Where to close a file handle opened at the beginning of a PHP script?

I have a PHP file in which, on the top I create a file handle using fopen(). Then then file has a couple of classes, in the functions of which I write stuff to this text file. And ultimately, in the end, i.e. when I am done writing stuff to this…
Shy
  • 542
  • 8
  • 20
1
vote
1 answer

get the file name from the file handle value

let's say I have a filehandle. Is there a way for me to know the name of the file it is writing to? I.e., you usually use: set fh [ open "fname" "w" ] I want a proc that would have the output: puts [ getFHFName $fh] >fname Any ideas?
user1134991
  • 3,003
  • 2
  • 25
  • 35
1
vote
2 answers

FileHandle not accepting my URLs for write access

I'd like to open a uniquely named output file for writing either plist or data, but not having any luck in getting a handle using either URL routine of init(fileURLWithPath:) or init(string:) func NewFileHandleForWritingFile(path: String, name:…
slashlos
  • 913
  • 9
  • 17
1
vote
3 answers

Getting file handle as an argument

In bash redirection, I asked a question and got an answer as follows. With cat < file, cat reads from its standard input; the shell opens the file and connects the file handle to cat Now, I’m curious how this is possible. I mean, how a…
plhn
  • 5,017
  • 4
  • 47
  • 47
1
vote
1 answer

Is there a way to open a file in a shared folder using the file id(FILE_ID_DESCRIPTOR) obtained from GetFileInformationByHandle()

Currently, i'm using the following functions to open the file using its id. volHandle = CreateFile(pVolName, ...); fileHandle = OpenFileById(volHandle, &id, ...) The id(FILE_ID_DESCRIPTOR) is obtained from GetFinalPathNameByHandle(). This works for…
kuarissu
  • 15
  • 6
1
vote
3 answers

Perl - Start reading from specific line, and only get first column of it line, until end

I have a text file that looks like the following: Line 1 Line 2 Line 3 Line 4 Line 5 filename2.tif;Smpl/Pix & Bits/Smpl are missing. There are 5 lines that are always the same, and on the 6th line is where I want to start reading data. Upon…
drewrockshard
  • 2,043
  • 10
  • 35
  • 47