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

Append zero bytes to a file

Is there a way to append zero bytes to a file without having to create a empty Data value? let handle : FileHandle = ... let count : Int = ... try handle.seekToEnd() try handle.write(contentsOf: Data(repeating: 0, count: count))
user965972
  • 2,489
  • 2
  • 23
  • 39
1
vote
0 answers

How to ignore cache when repeatedly reading from disk

I am writing an app that contains a small benchmark for I/O operations. For write operations, I am using a 'FileHandle' which works pretty well. I am testing my old USB stick and my calculation results in values of roughly 20MB/s which seems…
inexcitus
  • 2,471
  • 2
  • 26
  • 41
1
vote
1 answer

Facebook Graph API v10 image upload to Pages feed

I'm trying to upload a image to facebook via graph api v10. i have followed the docs: https://developers.facebook.com/docs/graph-api/resumable-upload-api/ I'm getting the File-Handle as result, but i dont know how to append this File-handle to my…
Leahpar
  • 583
  • 1
  • 4
  • 12
1
vote
2 answers

Perl's odd behavior when reassigning a filehandle variable from STDOUT to a file without undef()

When executing the following simplified code: use strict; # [01] use warnings FATAL => 'unopened'; # [02] # [03] my ($inHandle,…
mak
  • 197
  • 9
1
vote
1 answer

Thread communication via printf and scanf (linux)

Working in Linux and using C++. I have a program which initiates a thread. I need the main thread and the child thread to communicate via printf and scanf (the code for both threads uses scanf and printf and assumes that it communicates with stdin…
user302099
  • 635
  • 1
  • 5
  • 17
1
vote
4 answers

PHP for read txt file line just upon sign "#"

I have this txt file structure: "data";"data";"data";#;"my data";"my data";"my data" "data";"data";"data";#;"my data";"my data";"my data" "data";"data";"data";#;"my data";"my data";"my data" I need to read this file data just after the # sign. My…
CMartins
  • 3,247
  • 5
  • 38
  • 53
1
vote
1 answer

How to detect whether physical device is online or offline in Windows using pInvoke

I wrote code that can write and read data from physical disk. I open the physical disk using pInvoke CreateFile and use FileStream to perform read and write data. When physical disk is online, every thing works great. In case the physical disk is…
Yaniv daye
  • 73
  • 7
1
vote
0 answers

How do you handle OSError: [Errno 24] Too many open files?

Trying to download data using below HTTP request. This request would be made sequentially a few thousand times. with urllib.request.urlopen(url, timeout=120) as resp: with open(save_loc + '.part', 'wb') as fh: while True: …
Pavan Ajit
  • 11
  • 3
1
vote
0 answers

stdlib rename api opening new handle when trying to write over network to mounted location

I have a folder present in windows , which i am mounting from mac side using smb. Into this mounted location i'm trying to write a new file over the network. After writing the data into the file , the handle is closed. Now i need to rename the file…
1
vote
0 answers

Python: Trying to check if file exists and if not create new files and final output list

I have 2 input files that I want to modify and create new files if log file doesnt exist. All_files_with_path = ['/path/to/some/file/Test/Directory1/Name_xxx.yyy.ddd_Foo.input1',…
Ram
  • 547
  • 2
  • 4
  • 13
1
vote
2 answers

How to get a user-configurable buffer for printing?

I'd like to have a print function supporting a user-configurable buffer, so to print what I have in the buffer only when the buffer is > a threshold). I need to write multiple files, so I have multiple filehandles to write to, and for this an object…
Andrea T.
  • 920
  • 4
  • 15
1
vote
0 answers

How to replace words in a text file with a user input in C

I want to find a way to replace the word that was found the same with the user input. For instance, the user inputs "er" and then these words come up: What I want to do is replace the "er" on all of these words with again a user input. for example…
ImSkilzBTW
  • 11
  • 3
1
vote
0 answers

In python, how can I see where an object that is about to be garbage collected is originating from?

Somewhere in my program, I get a ResourceWarning saying that a file handle has been deleted that did not call close(). However, I am in a giant project and cannot easily find the file handle. How can I use the gc library to log the name of the file…
Jonathan Allen Grant
  • 3,408
  • 6
  • 30
  • 53
1
vote
2 answers

perl how to capture STDOUT of list form system call as a filehandle

The following prototypes demonstrate how one can capture the STDOUT of a "worker" script, called by the "boss" script, as a FILEHANDLE and turn the contents of FILEHANDLE into an array that one can manipulate in the "boss" script. The boss script…
Jacob Wegelin
  • 1,304
  • 11
  • 16
1
vote
2 answers

How can I determine if files in a "drop folder" are completely transfered

Remote clients will upload images (and perhaps some instructional files in specially formatted text) to a "drop folder." Once the upload is complete we need to begin processing these images. It would be an easy, but flawed, solution to just have a…
Buttons840
  • 9,239
  • 15
  • 58
  • 85