fifo

Bash script redirecting stdin to program and its output to another program

亡梦爱人 提交于 2019-12-12 05:46:07
问题 I'm just learning bash scripting. It's the first time I have to redirect output to another program and I don't know how to do it. I have to write a script which connects a GUI program, and zero, one or two programs - I need two players, both can be computer or human. GUI gets output from both programs (or humans, I mean from stdin). Let's assume that there is one human and one comp_player. Human gives command using stdin, this command has to be redirected to running GUI program and running

Fifo Inventory with SQL

送分小仙女□ 提交于 2019-12-12 03:34:24
问题 I need one adaptation for the first table because there are negative issues points and I need the net table considerating the negatives points as debit of the first time of issue. E.g: FechaEmi Cuenta PtosEmi PtosCan 30/06/2015 1 100 0 31/07/2015 1 120 0 31/08/2015 1 130 0 31/08/2015 1 0 55 30/09/2015 1 50 0 31/10/2015 1 30 0 30/11/2015 1 70 0 31/12/2015 1 95 0 31/01/2016 1 50 0 29/02/2016 1 0 74 31/03/2016 1 50 0 30/04/2016 1 15 0 30/06/2015 2 20 0 31/07/2015 2 30 0 31/08/2015 2 40 0 30/09

How do you programmatically configure the Serial FIFO Receive and Transmit Buffers in Windows?

自古美人都是妖i 提交于 2019-12-11 23:46:27
问题 From Device Manager in Windows it is possible to configure the Receive Buffer and Transmit FIFO Buffer sizes for a serial port from Advanced Settings for a COM port: I would like to configure the values for the TX and RX FIFO buffers for COM ports programmatically. Ideally a method to do it in LabVIEW or even via .NET / command line as both are easy to interface with from LabVIEW. Edit: Just to clarify this is in regards to the 16550 compatible UART FIFO buffers and not software buffers like

FIFO Stock Valuation Through CTE-Recursion

纵饮孤独 提交于 2019-12-11 19:37:08
问题 I have copied it from this site because it's been already closed but I needed it for further solution. thus, kindly help me out..... Problem : it's calculating the closing stock valuation through FIFO of issue as a whole. but i need cost of issues into Price column in the same row it belongs to itself. declare @Stock table (Item char(3) not null,[Date] datetime not null,TxnType varchar(3) not null,Qty int not null,Price decimal(10,2) null) insert into @Stock(Item , [Date] , TxnType, Qty,

Having trouble getting a Unix FIFO to work properly?

送分小仙女□ 提交于 2019-12-11 13:37:55
问题 I'm trying to write a simple daemon in Linux, which will create a FIFO, then collect anything written to the FIFO and write that data to a file at a later time. My expectations are that once my daemon has created the FIFO, I can do "echo text > /myfifo" repeatedly. When I'm done, I can do "echo quit > /myfifo" and my program will exit and write all data to disk. I'm currently using poll() to know when there's more data on the FIFO. This works fine until after the first time I echo data to the

c - How to check EOF when read() on FIFO

折月煮酒 提交于 2019-12-11 10:52:02
问题 In a client-server program, need check EOF for read() on a FIFO ? Questions: Does EOF in FIFO return 0 , or -1 with errno set? Does the rule also apply to other IPC facilities? @Update I still found the result wield, so need to continue ask about it. Following are the source code: cs_fifo.h: // fifo header #ifndef _CS_FIFO #define _CS_FIFO #define CLIENT_DATA_SIZE 2 #define SERVER_DATA_SIZE 10 #define SERVER_FIFO_PATH "/tmp/server_fifo" #define CLIENT_COUNT 3 #endif fifo_server.c: // client -

How to constantly read FIFO in C

守給你的承諾、 提交于 2019-12-11 03:22:13
问题 I want to read a fifo pipe constantly in C. My code example works, but since i use while(1) one of my CPU cores is at 100% all the time. So my question: Is there a smoother way to read the fifo, without killing the CPU? #include <stdio.h> #include <string.h> #include <fcntl.h> #include <stdlib.h> #include <unistd.h> #include <stdbool.h> bool suffix (char* base, char* str) { int blen = strlen(base); int slen = strlen(str); return (blen >= slen) && (0 == strcmp(base + blen - slen, str)); } bool

Matlab read from named pipe (fifo)

大憨熊 提交于 2019-12-11 02:55:55
问题 I am having trouble reading from a named pipe/fifo in matlab under linux. textread() on the pipe always returns "Empty matrix: 0-by-1". textread() blocks until data was written to the pipe. If I use fopen() and fscanf(), then fopen will block until it receives some data. The first call to fscanf() will return the written data, and all subsequent calls of fscanf() return nothing (e.g. '') without blocking. fread() behaves as fscanf() fgets() returns -1 Anyone knows how to read from a pipe? 来源:

Having a trouble with opening FIFO in C

巧了我就是萌 提交于 2019-12-10 15:38:59
问题 I'm having a trouble in opening FIFOs in C.. first I created them using mkfifo() function with permission : 0777, and when I tried to open them, it succeeded in opening the first FIFO only, then the process will stuck in opening the second FIFO, and this is my code : fd1 = open("FIFO1_PATH", O_WRONLY ); fd2 = open("FIFO2_PATH", O_WRONLY ); This will not be executed, but once I comment the second line, it executes ! Is there a limit for the number of opening FIFOs per process ? I don't know

FIFO behavior for Array.pop in javascript? [duplicate]

元气小坏坏 提交于 2019-12-10 12:38:22
问题 This question already has answers here : How do you implement a Stack and a Queue in JavaScript? (23 answers) Closed 3 years ago . I want an Array method similar to Array.pop() that exhibits First In First Out behavior, instead of the native FILO behavior. Is there an easy way to do so? Imagine a javascript console: >> array = []; >> array.push(1); >> array.push(2); >> array.push(3); >> array.fifopop(); 1 <-- array.pop() yields 3, instead 回答1: You can use array.prototype.shift() >> array = []