filehandle

Blocking file-read in php?

I want to read everything from a textfile and echo it. But there might be more lines written to the text-file while I'm reading so I don't want the script to exit when it has reached the end of the file, instead I wan't it to wait forever for more lines. Is this possible in php? ...

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 it to work (as I couldn't) just seek to a new point in the file, set discontinuous to ...

How can I suppress STDOUT temporarily in a Perl program?

Is there any easy way to tell perl "now ignore everything that is printed"? I have to call a procedure in an external Perl module, but the procedure prints a lot of unnecessary information (all through standard print). I know select can be used to redirect it somehow, but I am not too wise from reading perldoc on it. edit: I found th...

Reading a file using javascript

How do I read contents from a server side file using javascript? ...

How can I process a multi line string one line at a time in perl with use strict in place?

I'm trying to figure out the proper PBP approved way to process a multi line string one line at a time. Many Perl coders suggest treating the multi line string as a filehandle, which works fine unless you have "use strict" in your script. Then you get a warning from the compiler about not being able to use a string as a symbol while st...

Getting a file path from a file handle in Windows

In Windows, is there a straightforward way to get the full path of a file, given only the file's handle? I can't use GetFinalPathNameByHandle() because that's Vista+ only and our product has to work on XP. However, something that simple, or close to it, would be best. ...

How can I avoid Perl::Critic warnings when I process a multi-line string with a filehandle?

Does anyone have a solution to the task of processing a multi-line string one line at a time, other than the string-as-a-filehandle solution shown below? my $multiline_string = "line one\nline two\nline three\nline four"; my $filehandle; open( $filehandle, '<', \$multiline_string ) or croak("Can't open multi-line string as a filehan...

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), so that I can do things like pass it into subroutines and such. Is there any way to do this...

How to find & close all open file handles on a removable drive (before ejecting)

I'm trying to eject a (virtual) removable drive, and it fails because there are some file handles open, maybe explorer windows. What's the best way to get all the open handles to files on that drive and close them? Is it also feasible (within user-mode) to find any processes running off that drive, so I can warn the user with the proces...

How can I reset a file handle receiving standard input in Perl?

When I issue a Perl script some standard input, e.g. $ awk '{print $1"\t"$2}' foo.txt | myScript.pl I have a script which contains a bug. It reads the first line of standard input, gets something from that first line, and then only parses lines 2 through n of standard input on subsequent read: open (FH, "< $input") or die $?; my $fir...

read single line from text file in objective-C

Hi, I want to read a text file in Objective-C till a specified delimiter For eg:if this is my .txt input file , @abc = name1$ @xyz = name2$ i want to read abc and assign it in the string variable key,and read name1 till $ and assign it to variable value for eg:expected output key = abc value= name1 key = xyz value= name2 Kindly...

Please tell me how to find and replace particular word in a file using vb.net

i have created a template xml file witch contain some words like {contentname}. i need to replace such a tags with my values. please tell me how to search such a words and replace using filehandling in vb.net my xml templatefile is like this: <!-- BEGIN: main --> <?xml version="1.0" encoding="UTF-8"?> <OTA_HotelSearchRQ xmlns="http://ww...

How can I read from a Perl filehandle that is an array element?

I quickly jotted off a Perl script that would average a few files with just columns of numbers. It involves reading from an array of filehandles. Here is the script: #!/usr/local/bin/perl use strict; use warnings; use Symbol; die "Usage: $0 file1 [file2 ...]\n" unless scalar(@ARGV); my @fhs; foreach(@ARGV){ my $fh = gensym; ...

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 datat to file #4 ...

Is there a way to access a string as a filehandle in php?

I'm on a server where I'm limited to PHP 5.2.6 which means str_getcsv is not available to me. I'm using, instead fgetcsv which requires "A valid file pointer to a file successfully opened by fopen(), popen(), or fsockopen()." to operate on. My question is this: is there a way to access a string as a file handle? My other option is to ...

What does “select((select(s),$|=1)[0])” do in Perl?

Possible Duplicate: What does select((select(s),$|=1)[0]) do in Perl? What's the purpose of the second line ? open my $fh, '>>', $logfile or die $!; select((select($fh), $|=1)[0]); ...

ant error Unable to rename old file to temporary file

I'm using ant 1.8.0 and java 1.6.0.17 and I'm running into a strange problem. In my build.xml, I have a simple task that compiles the code <javac destdir="${dir.build.classes}" debug="on"> <classpath refid="classpath"/> <src path="${dir.src.java}"/> </javac> In the "classpath" is a jar, call it library.jar In a later task, I...

How can a Perl subroutine distinguish between file names, file handes, *DATA, and *STDIN?

If I have a function that might be passed a file name or various file handles or typeglobs, how can the function distinguish among these arguments -- including telling the difference, for example, between *DATA and *STDIN? Updated code, based on answers received so far Thanks, everyone. use strict; use warnings; use FileHandle; sub fi...

Get signalled when a file handle is acquired

What's the best way for getting signalled (similar to AutoResetEvent) when an exclusive handle to a file is acquired? (e.g. at the end of a huge file copy) ...

How to get open write handles on a file using C#?

I'm copying from a client computer to a server computer in a shared directory. My server detects the new file, and after the copying is complete it has to process it. The problem is that, when writing a big file and using FileSystemWatcher, you get no indication whether the copying is done or not. The only way to check this is by trying ...