So I've always toyed around with C# code with the idea of gaming. Lately I've been dabbling in communication. Initially I tried sockets and TcpClient and that was hit and miss. So I decided to give pipes a go. Frankly I dont have much of a preference of one of the other. I just wanted something I could eventually use over the internet. Extremely long term I plan to add encryption, a chat, movement for players (probably something UDP). For the short term I'm basically just trying to achieve something TCP/IP where I can easily send something like a key …

Member Avatar
+0 forum 0

Alright so I am getting a weird problem with the following code int toDB[2]; int fromDB[2]; char * param1; char * param2; err = pipe(toDB); if(err==-1) { printf("Error on pipe creation: %d\n", errno); exit(1); } sprintf(param1, "%d", toDB[0]); err = pipe(fromDB); if(err==-1) { printf("Error on pipe creation: %d\n", errno); exit(1); } sprintf(param2, "%d", fromDB[1]); The last line of code `sprintf(param2, "%d", fromDB[1]);` is the line causing the problem, if it is commented out the code runs, if it is not commented out I get a core dump, can anyone see what i am doing wrong? NOTE: This is not the …

Member Avatar
Member Avatar
+0 forum 5

sds

Member Avatar
Member Avatar
+0 forum 2

Hello. I need to set up some pipes for a homework assignment as part of a bigger project. The issue I'm having is that the array (args) I'm using to populate the pipe arguments keeps segfaulting and I don't know why. Everything has been malloced beforehand and the faults only occur at the mentioned places. Below, the relevant code: char** args; char** pipe1_args; int pipe1_args_size; char** pipe2_args; int pipe2_args_size; while (temp_std_command && array_size <= 255) //take args and break them up into an array { args[i] = malloc(sizeof(char)*255); strcpy(args[i], temp_std_command); temp_std_command = strtok(NULL, " "); i++; array_size++; } i++; array_size++; …

Member Avatar
Member Avatar
+0 forum 2

Ok so am writing a program that simulates a computer system.The cpu and memory will be forked making memory a child process and cpu athe parent and i will be using pipes to let them exchange informatino. I am really lost tough on what to do next, i have loaded my program.txt to memory and set up a basic cpu skeleton but not sure how to implement this, two operations: which are memory operations read(address) returns the value at the address write(address, data) writes the data to the address heres what i have so far please disregard my forking and …

Member Avatar
Member Avatar
+0 forum 1

Hey, I have some command, I'll call it "command". I need to do this: yes | command but without a pipe, there is a reason for this, because for the specific use, pipe before the command is not allowed, that's not the point. Is there an alternative I can use which will output do the same thing without the pipe ? Maybe something like this: command < yes (which will not work because it expects a file, and not a command) ? Or some other simple way ? Thanks

Member Avatar
Member Avatar
+0 forum 5

Hi, i am not sure whether this topic would go under this category, thought this would be more suitable what are the famous software architectures? i have to do an research on this an present, I am new to this topic appreciate a reply thanks

Member Avatar
Member Avatar
+0 forum 8

hi, does any one know about the pipe & filter architecture implemntation in C# have a question in that.

Member Avatar
Member Avatar
+0 forum 3

HI, I want to implemtna a file & filter architecture for reading data from a txt file and then removing the non alpahbatical words in it and display the 20 words in alphabatical order in the Consol window. how do i do it. appreciate a reply, thanks

Member Avatar
Member Avatar
+0 forum 13

Hi. I have a class called step and in it i have a method `public IEnumerable<string> Execute(IEnumerable<string> input) ` when i trying creating a thread i did it as below List<string> l = new List<string>(); l.Add("a"); l.Add("r"); l.Add("d"); step s = new step(); Thread t3 = new Thread(s.Execute(l)); t3.Start(); give me a error msg "Error 1 The best overloaded method match for 'System.Threading.Thread.Thread(System.Threading.ParameterizedThreadStart)' has some invalid arguments \Program.cs 25 25 PipeFilter " and "Error 2 Argument 1: cannot convert from 'System.Collections.Generic.IEnumerable<string>' to 'System.Threading.ParameterizedThreadStart'Program.cs 25 36 PipeFilter " how to i resoleve this appreciate a reply thanks

Member Avatar
Member Avatar
+0 forum 2

HI, How can I read from a txt file using threads in C#, regards

Member Avatar
Member Avatar
+0 forum 2

In a client server program ... generally when the server goes down the client on executing the send command 2 times returns a SIGPIPE signal . I want to know y this happens. The client must recieve sigpipe immediately when it sends a message after the socket connection is broken . I have tried many versions of client server programs , when i close the server down , client after it sends 2 messages only is it able to receive a sigpipe signal, shouldn't it be like the cleint receives sigpipe immediately after it sends any msg ??

Member Avatar
Member Avatar
+0 forum 5

Hi, I was wanting to write a (ba)sh script to allow me to wait for the detection of a new USB device, and when that device is detected, execute some commands. The scripts are intending to be working on the principle that whenever I plug in a usb device a message containing the words "new" and "USB" is appended to /var/log/messages. I want this program to be running in the background of my computer at all times, so I want one that will take as little cpu power as it can when there is nothing for it to do. I …

Member Avatar
Member Avatar
+0 forum 2

after tokenising my string i am the tokens to the method below and counting the tokens. if token number is one, that means i have one command only and pass it from execvp.. if i have a second token then pass that token from the second execvp.. This gives me no error as well as no output... Also it will not work with 3 or more commands i suppose. Please show me the way how I can fix it... Thanks... [CODE] count ++ ; if(count == 1) { command1 = token; } if (count == 2) { command2 = token; …

Member Avatar
+0 forum 0

Hi, I made a program that lists all possible anagrams of a word.Now I'd like to include anagrams of subsets of letters in the word.I have the code for making the subsets also now.But i do not want merge them as a single code.So I'd like to know if there is a way pipe the output of one to another in VC++.They are in the same project file in VC++,if that matters. Thanks in advance, Prasanna.

Member Avatar
Member Avatar
+0 forum 2

I am trying to write some tool for MSDOS environment but it doesn't work as expected. I want to get the tool to read from some commandline pipe, like C:\> type a.txt|testpipe where testpipe.exe is the compiled program. The problem: After going through the piped contents, it does not stop at the [COLOR="Green"]CIN[/COLOR] prompt marked in red. It just skips the reading but outputs all the prompts. [COLOR="Red"]Do I need to do something to fix the input after the pipe so it reads from the terminal?[/COLOR] [CODE]#include<iostream> #include<string> using namespace std; int main(int argc,char*argv[]) { char a[100]; string b; while(cin.getline(a,100)) …

Member Avatar
Member Avatar
+0 forum 4

Hello there, I'm new to C programming and am following a course in C. I've got an example code for piping. It's not a very hard code to understand. It goes like this: [CODE] #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #define READ_END 0 #define WRITE_END 1 const char banner [] = "hello there\n"; int main() { int pipe_ends[2]; pid_t pid; if(pipe(pipe_ends)) { printf("Could not create pipe\n"); return -1; } pid = fork(); if(pid < 0) { printf("Fork failed\n"); return -1; } if(pid > 0) { /* parent */ int i; close(pipe_ends[READ_END]); for(i=0; i<10; i++) { printf("Parent Writing [%d]...\n",i); …

Member Avatar
Member Avatar
+0 forum 3

What is the best way to terminate ReadFile once the data is done being read? I just sits there an hangs! I'm kinda new to Python so be easy on me! :) The other way i was able to read info from my pipe was blah = open(pipe) then blah.read() but i end up in the same situation. [CODE] pipeName = "\\\\.\\PIPE\\MYPIPE" try: pipeHandle = win32file.CreateFile(pipeName,win32file.GENERIC_READ,0,None,win32file.CREATE_NEW|win32file.OPEN_EXISTING,0,None) except: print "App Not running..." debugLog = '' while (1): try: hr, data = win32file.ReadFile(pipeHandle, 8192, None) if len(data) > 1: debugLog = debugLog + data if "Boot" in debugLog: print "Booted to DOS..." …

Member Avatar
+0 forum 0

Hello, I want to redirect stdin and stdout of "cat" program to my program. For example if I type "cat" in terminal, and enter input and press enter it outputs the same string I entered. In my c program I am trying to use pipes and dup. I cannot figure out why it is not working. When I launch it, it exits without reading stdout of "cat". Here is what I have so far: [CODE] #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #define STDIN fileno(stdin) #define STDOUT fileno(stdout) #define STDERR fileno(stderr) int main(int argc, char *argv[]){ int p2c[2] = …

Member Avatar
Member Avatar
+0 forum 1

Hi, I have some questions about multi pipe. First of all, What I should do is making 6 child processes and each of child process reduces a global value (by 1) which is saved in malloc concurrently until the value reaches 0. All I could find from google was about read and write a message in buffer between a parent and a child processes. How do I have to implement it? Where do I have to write such code as "global_value--;"? And some examples used "command" like linked list (next=command->next) what does linked commands do in multi pipe environment? please …

Member Avatar
Member Avatar
+0 forum 1

I am trying to pipe an email to PHP. I currently have set up a forwarder in cPanel that does the following : [B]|/home/username/public_html/mailscripttest.php[/B] mailscripttest.php has permissions 755 and contains: [CODE=php] #!/usr/bin/php –q <? /* Read the message from STDIN */ $fd = fopen("php://stdin", "r"); $email = ""; // This will be the variable holding the data. while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); /* Saves the data into a file */ $fdw = fopen("mail.txt", "w+"); fwrite($fdw, $email); fclose($fdw); /* Script End */ [/CODE] However when I send an email I get a bounced message saying: [QUOTE] This …

Member Avatar
Member Avatar
+0 forum 1

Hi, I’m trying to use the following code in C++ on Mac OS X Snow Leopard to get the output of an external program through a pipe. [code=c++] FILE * al = popen("program program.cfg", "r"); string data; char buffer[100]; while (fgets(buffer, 100, al) != NULL) data.append(buffer); cout << "«" << data << "»" << endl; pclose(al);[/code] However, no data gets printed out. I suspect the problem lies in the fact that the external program outputs to *wcout* and *wclog*, but I’m not sure how to deal with it. I also tried using a *wstring* and *fgetws*, but that didn’t help …

Member Avatar
Member Avatar
+0 forum 2

A program that handles either piped input (command/prog | your_prog) or file redirected (your_prog < file_name) input. Determine whether such input exists before issuing a stdin read so that the program does not go into a "waiting for input" state. Written in/for the XP environment.

Member Avatar
Member Avatar
+0 forum 1

The End.