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
4
votes
5 answers

Get file name without extension?

I'm new to C++ world, I stuck with a very trivial problem i.e. to get file name without extension. I have TCHAR variable containing sample.txt, and need to extract only sample, I used PathFindFileName function it just return same value what I…
Prashant Cholachagudda
  • 13,012
  • 23
  • 97
  • 162
4
votes
1 answer

How best to override/wrap core functions like sysread when they are called in another package

I'm working on a fairly complex application written in Perl. I'm fairly experienced with the language, but I'm just stumped on this. I'm using a module, Foo, which uses sysread and syswrite for various operations on a file-handle (a bi-directional…
Hercynium
  • 929
  • 9
  • 18
4
votes
2 answers

Controlling inheritability of file handles created by C++ std::fstream in Windows

In Windows, when creating a process with CreateProcess, one can pass true as the bInheritHandles argument. CreateProcess( , , , , bInheritHandles, , , , ) This means that all file handles marked to be inheritable will be, indeed, inherited by the…
Mercalli
  • 700
  • 6
  • 16
4
votes
1 answer

Does Perl 6's eof give up too quickly?

In Perl 5 I can check if standard input is open and read one line from it. for (;;) { last if eof(STDIN); print "Got line " . readline(STDIN); } When I run it an enter a line of input it reads that line and does its work before moving…
brian d foy
  • 129,424
  • 31
  • 207
  • 592
4
votes
2 answers

Why doesn't a filehandle need a sigil in Perl?

In Perl, filehandle is a data type, and I'd expect a variable of such type has some kind of sigil prefix. However, the following code (2nd open) shows that it's not the case open my $fileHandle, '>', "out.txt"; open FH, '>', "out2.txt"; I found…
Ltf4an
  • 787
  • 5
  • 18
4
votes
2 answers

Check if file is locked by a process filehandle

Given I have a list of all file handles of all processes, how could I find out which of these handles are actually locking a file? From what I understand I could simply try to open the files and try to get all the permissions and if something goes…
Forivin
  • 14,780
  • 27
  • 106
  • 199
4
votes
1 answer

OSX Custom extension icon Association

I'm trying to get my application to display an icon for a custom file extension using the following code: CFBundleDocumentTypes CFBundleTypeName My Custom…
mystro
  • 347
  • 3
  • 11
4
votes
3 answers

Is there a way to be notified when 'print' is called on $fh?

When I do: print $fh 'text'; I need a some &sub to be called. It there a way to do that?
Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158
4
votes
1 answer

Is there a perl module that can start a process and return the three main I/O handles to that process?

In perl, I often need to run a child process, send some input to it, and then read its output. There are a number of modules to do this, but they all seem to require you to pass in pre-existing variables, which are then modified by the function to…
Ryan C. Thompson
  • 40,856
  • 28
  • 97
  • 159
4
votes
1 answer

Cleanly shutdown JGit

I've created a local repository using JGit API's. When all processing is done, I'd like to delete the local repo (which is a simple java.io.File). However File.delete() operation fails. I'm already…
qwerty
  • 3,801
  • 2
  • 28
  • 43
4
votes
2 answers

When does ref($variable) return 'IO'?

Here's the relevant excerpt from the documentation of the ref function: The value returned depends on the type of thing the reference is a reference to. Builtin types include: SCALAR ARRAY HASH CODE REF GLOB LVALUE FORMAT IO VSTRING Regexp Based…
Zaid
  • 36,680
  • 16
  • 86
  • 155
4
votes
1 answer

How to get file handle of a process?

I'm trying to get file handle of any running process in C++ . This is my code: #include #include #include #include #include void killProcessByName(const char *filename) { HANDLE…
4
votes
3 answers

Access to Perl's empty angle "<>" operator from an actual filehandle?

I like to use the nifty perl feature where reading from the empty angle operator <> magically gives your program UNIX filter semantics, but I'd like to be able to access this feature through an actual filehandle (or IO::Handle object, or similar),…
Ryan C. Thompson
  • 40,856
  • 28
  • 97
  • 159
4
votes
1 answer

Pass file handle to cython function

I want to compile a python function with cython, for reading a binary file skipping some records (without reading the whole file and then slicing, as I would run out of memory). I can come up with something like this: def FromFileSkip(fid,…
user2061949
  • 205
  • 1
  • 3
  • 7
4
votes
1 answer

Can Linux inotify be used on opened filehandles?

I'm familiar with how to use inotify to monitor for changes to named files within directories, but I'm currently wondering if it's possible to use it to watch for modifications of a file only known by an opened filehandle. Is such a thing…
LeoNerd
  • 8,344
  • 1
  • 29
  • 36