pipe

What's a simple method to dump pipe input to a file? (Linux)

I'm looking for a little shell script that will take anything piped into it, and dump it to a file.. for email debugging purposes. Any ideas? ...

C# Console receive input with pipe

I know how to program Console application with parameters, example : myProgram.exe param1 param2. My question is, how can I make my program works with |, example : echo "word" | myProgram.exe? ...

Efficient data transfer from Java to C++ on windows

I'm looking to stream lots of data (up to ~1 Gbit) from Java to a C++ application (both on the same machine). I'm currently using a FIFO on Linux but need a Windows solution too. The most cross-platform method seems to be a local socket, but: a) won't I get huge overhead from TCP checksumming and copying to & from kernel space, and b) w...

windows cmd pipe not unicode even with /U switch

Hello, I have a little c# console program that outputs some text using Console.WriteLine. I then pipe this output into a textfile like: c:myprogram > textfile.txt However, the file is always an ansi text file, even when I start cmd with the /u switch. cmd /? says about the /u switch: /U Causes the output of internal commands...

pipes in Visual Studio build events

I'm using Visual Studio 2005 Express Edition with SP1. I have a Pre-Link Event which needs to invoke one program and send its output to another. foo | bar This command works as expected when invoked from a command line or batch file. The command fails when invoked from the Pre-Link Event (even if the Pre-Link Event invokes a separate...

Using the F# pipe symbol with an object constructor

I'm trying to figure out the correct syntax to use the pipe operator |> into the creation of an object. Currently I'm using a static member to create the object and just piping to that. Here is the simplified version. type Shape = val points : Vector[] new (points) = { points = points; } static member create(poi...

How can I get forking pipes to work in Perl on Windows?

I'm trying to port a Perl script over from Unix to Windows but am having a near impossible time getting it to work due to the unsupported forking pipes in the open function. Here's the code: sub p4_get_file_content { my $filespec = shift; return 'Content placeholder!' if ($options{'dry-run'}); debug("p4_get_file_content: $f...

How can I use fprintf and write to a pipe?

I created a pipe and I used dup2() to overwrite streams 1 & 2 (stdout & stderr) into those pipes. Now I wish to use fprintf to write to stream 1 or 2, but my program doesn't seem to be receiving anything on the other side of the pipe. I've tried using printf(), but I'm not sure if this writes to stdout or stream 1 by default. If it writ...

TextMate: Preview in Firefox without having to save document first?

Using TextMate: Is it possible to assign a shortcut to preview/refresh the currently edited HTML document in, say, Firefox, without having to first hit Save? I'm looking for the same functionality as TextMate's built-in Web Preview window, but I'd prefer an external browser instead of TextMate's. (Mainly in order to use a JavaScript co...

Creating a pipe between C# and Ffmpeg

Hi guys, I have a C# program that creates a video and saves it to the disk in real-time. Instead of doing that, I want it to write it directly in a pipe connected with ffmpeg... The function that keeps saving the video in the disk, which I can not control, receives an IntPtr with a reference to the file. So, I need to create a pipe or...

How do I send large amounts of data from a forked process?

I have a ctypes wrapper for a library. Unfortunately, this library is not 100% reliable (occasional segfaults, etc.). Because of how it's used, I want the wrapper to be reasonably resilient to the library crashing. The best way to do this seems to be forking a process and sending the results back from the child. I'd like to do something...

How do you use Notepad++ regex pipe | for strings longer than one character?

I'm trying to get notepad++ to regex find all instances of "abc" and "def" in the following sentence: The abc went to the def. None of the following syntaxes seem to work: abc|def [abc|def] (abc)|(def) (abc|def) NOTE: "[a|d]" matches any instance of "a" or "d" when I tested ...

in windows, how to have non-blocking stdin that is a redirected pipe?

I have a Windows C program that gets its data through a redirected stdin pipe, sort of like this: ./some-data-generator | ./myprogram The problem is that I need to be able to read from stdin in a non-blocking manner. The reason for this is that (1) the input is a data stream and there is no EOF and (2) the program needs to be able to...

Distinguishing a pipe from a file in windows

On Unix, everything is a file, so you can use file i/o functions with pipes, files, sockets, etc. But on windows, the api you use depends on the type of i/o HANDLE you have. My question is: given a HANDLE how do you determine what the underlying type is? For example, I have a HANDLE that's either real file, or a named/anonymous pipe. ...

Distinguishing a pipe from a file in Unix

Given a FILE*, is it possible to determine the underlying type? That is, is there a function that will tell me if the FILE* is a pipe or a socket or a regular on-disk file? ...

Having trouble with fork(), pipe(), dup2() and exec() in C

Here's my code: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <wait.h> #include <readline/readline.h> #define NUMPIPES 2 int main(int argc, char *argv[]) { char *bBuffer, *sPtr, *aPtr = NULL, *pipeComms[NUMPIPES], *cmdArgs[10]; int fdPipe[2], pCount, aCount, i, status, lPids[NUMPIPES]; pid_t pid; ...

Is there a command-line shortcut for ">/dev/null 2>&1"

it's really annoying to type this whenever I don't want to see a program's output. I'd love to know if there is a shorter way to write: $ program >/dev/null 2>&1 Generic shell is the best, but other shells would be interesting to know about too, especially bash or dash. ...

Does this multiple pipes code in C makes sense?

I've created a question about this a few days. My solution is something in the lines of what was suggested in the accepted answer. However, a friend of mine came up with the following solution: Please note that the code has been updated a few times (check the edit revisions) to reflect the suggestions in the answers below. If you intend...

Problems with pipe in PHP regular expression

I've been writing a plugin for Joomla that automatically processes HTML comments eg. {dropcap}B{/dropcap} and creates a drop cap style. I needed a way to pass on parameters to the plugin so therefore decided the best way would be: {dropcap}B|FF00FF|00FF00{/dropcap}. I created a function: if (preg_match_all('/{dropcap}(.+?){\/dropcap}/...

How do you pipe input through grep to another utility?

I am using 'tail -f' to follow a log file as it's updated: tail -f logfile I next pipe the output of that to grep to show only the lines containing a search term ("org.springframework" in this case): tail -f logfile | grep org.springframework The third step I'd like to make is piping the output from grep to a third command, '...