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.
Questions tagged [filehandle]
407 questions
3
votes
2 answers
Why ref does not return 'GLOB'?
I want to understand typeglobs better and write small programm:
use Symbol;
open F, '>', \my $var;
t( F );
t( \F );
t( *F );
t( \*F );
sub t {
my $fh = shift;
print ">>$fh<<" . ref( $fh ) ."\n";
}
The output…

Eugen Konkov
- 22,193
- 17
- 108
- 158
3
votes
1 answer
fix the column width in .txt file using c++
i have created one class of doctor and i want to insert data of doctor in note pad file (Doctor.txt) but data do not have a symmetry because there is no fixed length of my inputs in the line...
int DocID;
string…

Anwar Ali
- 31
- 2
3
votes
1 answer
How to call a system file selection dialog using perl on windows?
I know many perl based gui module would do that easily but I am curious about methods other than Prima or Tk etc.
I want to call this dialog (Exactly looking as Windows Explorer) for a command line package.
Is anything similar to system(''); command…

BioDeveloper
- 618
- 3
- 8
- 25
3
votes
4 answers
How can I read from a method that returns a filehandle in Perl?
I have an object with a method that returns a filehandle, and I want to read from that handle. The following doesn't work, because the right angle bracket of the method call is interpreted as the closing angle bracket of the input reader:
my $input…

Ryan C. Thompson
- 40,856
- 28
- 97
- 159
3
votes
0 answers
streamReader for server URLs
I've been working with the code form this answer, provided by Martin R. The code is awesome and it is very useful. However, it doesn't work with the links, while working fine with files. After putting some NSLogs and breaks, I have actually found…

Anna-Lischen
- 856
- 1
- 16
- 35
3
votes
0 answers
Determine opened file handle mode on Windows
The following code will give you the mode that a given handle is opened in (<, >, etc.):
use Fcntl qw(F_GETFL);
my $flags = fcntl($fh, F_GETFL, my $junk);
$flags is a number indicating the open mode (numbers defined by other macros provided by…

Nate Glenn
- 6,455
- 8
- 52
- 95
3
votes
1 answer
Open MPI and Boost MPI using too many file handles
I'm running a project using Boost MPI (1.55) over Open MPI (1.6.1) on a compute cluster.
Our cluster has nodes that have 64 CPUs and we spawn a single MPI process on each. Most of our communication is between individual processes, each having a…

Marc
- 33
- 2
3
votes
1 answer
Discard open files when process is killed
Is there a way to write-open files on Linux in C/C++ application in such a way that if the application is killed the open files will be discarded?
The application can be killed by SIGKILL so I cannot use signal handler.

jackhab
- 17,128
- 37
- 99
- 136
3
votes
3 answers
How can I generate several Perl filehandles programmatically?
Is there any way in Perl to generate file handles programmatically?
I want to open ten files simultaneously and write to them by using file handle which consists of (CONST NAME + NUMBER). For example:
print const_name4 "data.."; #Then print the…

dan
- 885
- 2
- 9
- 18
3
votes
4 answers
How do I get a filehandle from the command line?
I have a subroutine that takes a filehandle as an argument. How do I make a filehandle from a file path specified on the command line? I don't want to do any processing of this file myself, I just want to pass it off to this other subroutine,…

cowgod
- 8,626
- 5
- 40
- 57
3
votes
1 answer
Lib Gdx json serializationexception and missing no-arg constructor
When trying to execute this piece of code:
public void load(String filename) {
FileHandle file = Gdx.files.external(filename + ".bim");
Json json = new Json();
String text = file.readString();
datamap.clear();
datamap =…

bertvo
- 75
- 2
- 9
3
votes
1 answer
On iPhone, how can I use fileHandle to download a mp3 file on the fly?
I am trying to implement the AudioFileStreamSeek feature on my streaming app. But there is no way I can get this running. Even Matt Gallagher said on his blog:
Icidentally, the AudioFileStreamSeek function seems completely broken. If you can't get…

RoundOutTooSoon
- 9,821
- 8
- 35
- 52
3
votes
1 answer
Writing a large number of files from a long running process?
I have a project which scans a large file (2.5GB) picking out strings which will then be written to some subset of several hundred files.
It would be fastest just to use normal buffered writes but
I'm worried about running out of filehandles.
I…

hippietrail
- 15,848
- 18
- 99
- 158
3
votes
9 answers
How do I add lines to the top and bottom of a file in Perl?
I want to add a line to top and bottom of the file. I can do it following way.
open (DATA, ";
close(DATA);
open (FILE, ">/usr/new") || die "cant open new\n";…

shubster
- 825
- 4
- 13
- 39
3
votes
4 answers
Can I read and write to multiple filehandles simultaneously (Perl)?
I'm trying to read from two files, and generate output in a third. I first wanted to edit the first one on the go but I didn't find a suitable method save for arrays.
My problem is that the third file (output) is empty whenever I uncomment the…

Isaac Clarke
- 717
- 1
- 9
- 19