C++ :: Create Process And Assign Pipe Terminal Like Stoudt

May 30, 2014

I have study that create a pipe and set a terminal of this pipe like a stdout of a process is a way to implement inter process comunication, but how can i do it in c++?

View 2 Replies


ADVERTISEMENT

C++ :: How To Create Zombie Process

Nov 25, 2014

I am looking into how to create zombie process. They are created when parent process don't call wait() and hence they are not removed from the process table. How do I create zombie process in C++? What part of the code when missed, make a process/thread zombie? Is it the pthread_join()?

View 2 Replies View Related

C :: Create 9 Child Processes And Eventually Write From Each Process To Another?

Nov 18, 2013

I want to create 9 child processes and eventually write from each process to another. How can I specifically create 9 child processes and leave them running? Right now, I am using a loop from i=0 to i=8 and running fork() within that loop, but each child process also runs the loop, which spawns dozens (maybe hundreds?) of processes. I specifically only want to create nine of them. How can I do this?

Code:
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>

[Code].....

View 7 Replies View Related

Visual C++ :: Create Process And Wait For Input Idle

Feb 13, 2014

I have a problem with creating a process and waiting until the main window of the new process was shown. I thought I can wait for it with

WaitForInputIdle(pi.hp,INFINITE);

But when the function returns, the handle of the main window of the new process is not available. If I include also a ::Sleep(), the new window is available. Sleep is a bad solution. How can I do it?

View 3 Replies View Related

C++ :: Create Array Of Playing Cards / Assign Values And Suits Then Shuffle The Array

Nov 24, 2014

I got this program to create an array of playing cards and assign the values and suits and shuffle the array. I'm at the point where I need to output the cards but I need to burn the first card by making it output "**" instead of the card. my cards[] is a constant so I can's assign the first card as such.

void showCards(const int cards[], int numCards, bool hideFirstCard) {
if (cards[0]) {
hideFirstCard=true;
cards[0] = '**';
} for(int a = 0; a <= numCards; a++) {
cout >> showCard(cards[a]);
} }

View 1 Replies View Related

C/C++ :: How To Get CTRL Z To Close A Pipe

Nov 9, 2012

My 'c' program reads each line of a .txt file, makes a few changes and then outputs the line of text (which are names). I want the contents to be sorted and did not want to bother writing my own sort. The program runs in a command prompt from inside a batch file for example:

sort | makelist.exe BluRay1.txt > sorted.txt
sort | makelist.exe Dvd1.txt >> sorted.txt
..etc..

I have to supply a ctrl-z manually to close the piping. I tried the following which did not work.

buffer[0] = 26;

printf("%c",buffer[0]);
//printf("^(z)");
fclose(stdout);
fclose(stdin);

I never got the above to work so I am avoiding piping and just do a redirect instead.

makelist.exe dvd1.txt > unsorted.txt
makelist.exe dvd2.txt >> unsorted.txt
sort < unsorted.txt > sorted.txt

..etc.

Just wondering if I could have gotten the ctrl-z thru the pipe using "C".

View 2 Replies View Related

C/C++ :: Infinite Loop While Reading From Pipe?

Oct 31, 2014

Why I have an infinite loop when reading from a pipe?

i = 0;
while(i < 10) {
test_value = read(pipe3[READING], &message, sizeof(struct MESSAGE));
printf("test_value is %d
", test_value);
//printf("Entering infinite loop

[code]....

View 10 Replies View Related

C++ :: Restore Keyboard Stdin After Reading From Pipe?

Apr 25, 2014

I use the following code segment to read and output the text piped to a program. If there is no piped text, the code segment is skipped and then the program continues. What I need to do is restore stdin to the keyboard after reading from the pipe. I use the PeekNamedPipe() and ReadFile() because reading from stdin blocks until it has something, and I don't want that to happen. After reading from the pipe, the program begins to execute, and the main loop can be paused and it prompts for a command. I just can't figure out how to restore input to the keyboard. Obviously the platform is Windows.

char char_buffer[1024];
DWORD bytes_read;
DWORD bytes_avail;
DWORD dw;
HANDLE stdin_handle;
bool is_pipe = false;

[code]....

View 4 Replies View Related

C/C++ :: Combing While Loop Read With Creating A Pipe

Oct 30, 2014

I have this if block that is supposed to be creating a pipe then forking and I would like to combine the while loop below it with it. How would I do that?

p = pipe(pipe1);
if (p < 0) {
printf("pipe error");
exit(0);
} else {
printf("successful pipe1 = %d",p);

[Code].....

I have trying to read this documentation but don't understand it. [URL] ....

View 1 Replies View Related

C/C++ :: Parsing String Data Separated By Pipe Delimit

Mar 7, 2014

i tried to parse the string data seperated by Pipe('|') delimiter, here i am getting some error.Please find the below code.

[char* getData(){
char* string = "1355|||250|New";
char* tok1[10],tok2[10],tok3[10],tok4[10],tok5[10];
sscanf(string,"%[^'|'],%[^'|'],%[^'|'],%['^|'],%s",tok1,tok2,tok3,tok4,tok5);
printf("%s %s %s %s %s",tok1,tok2,tok3,tok4,tok5);
}]

I want to print the Value 250 in my string, but it was displaying some garbage values.

View 1 Replies View Related

C++ :: Sending Dynamic Allocated 2D Array Over Named Pipe Between 2 Executable

Oct 6, 2014

Im writing a scientific software where I like to sent a 2D array (5x4) over a named pipe from a server to a client. When im sending a static array (i.e., double res[5][4];), all goes fine and it works perfect, but when I allocate a dynamic array, it provides some nonsense numbers at the client side. I feel it might be caused because I point to a memory that cannot be shared through a pipe. Am I right and how can I pass the dynamic allocated array itself over the pipe.

//Server program

// Create a pipe to send/receive data
HANDLE pipe = CreateNamedPipe(
"\.pipemy_pipe", // name of the pipe
PIPE_ACCESS_DUPLEX, // 2-way pipe -- send and read
PIPE_TYPE_BYTE, // send data as a byte stream
1, // only allow 1 instance of this pipe
0, // no outbound buffer

[Code] .....

View 2 Replies View Related

Visual C++ :: Writing To Named Pipe Coming From A Service (session 0) Without Admin Rights

Dec 9, 2014

I'm trying to write to a named pipe created by a service, as we all know the session 0 isolation implemented in vista and forward makes this task a bit complicated.

well at this point i managed to make almost all to work but my real problem comes when i try to write on the named pipe from my GUI application with no administrator rights

If i run the GUI application with admin rights it works 100% but, I don't need that application to require the user admin rights and for security reasons i rather to leave it without admin...

so i started my research and i found that there is a way to achieve this by calling CreateNamedPipe() with a low integrity security attributes...

well how to implement but i finally made it, the problem is that it gets worse than passing null security attributes, it works with admin rights with NULL security attributes, but when i pass the low integrity security attributes it gives "access denied" even when using admin rights, so i guess im passing the wrong security attributes but how to manually create the security descriptor string.

This is the code:

Service (session0) SERVER

Code:
DWORD WINAPI PipeThreadRSVS(void* pParameter){
LPTSTR _PIPE_NAME = "\.pipeRSVHPipeIn";
bool Break=false;
char Received_Buffer[BlockSize+16];
DWORD BytesRead = 0;

[Code] ....

View 2 Replies View Related

C++ :: How To Hide Console Or Terminal

Jul 2, 2013

I want to hide a terminal appliction or console application without using WinAPI programming or <windows.h> or something like "ShowWindow(hwnd_win,SW_HIDE);

View 19 Replies View Related

C++ :: Can't Open A Directory In Terminal

Jan 12, 2015

Taking a OS course and my professor gave us files to reference in a directory located at ~agw/class/os/share/proj3. But when I typed this into the terminal I keep getting a permission denied error message.

[lastname@erdos ~]$ ls
dead.letter Desktop Documents Downloads Music Pictures private Public public_html Templates Videos
[lastname@erdos ~]$ ~agw/class/os/share/proj3
/u/sobolev/agw/class/os/share/proj3: Permission denied.
[lastname@erdos ~]$

I'm not sure what I am doing wrong. Ive opened shared directories for this class before and had no issues.

View 1 Replies View Related

C++ :: Cannot Open A Directory In Terminal

Dec 9, 2013

Taking a OS course and my professor gave us files to reference in a directory located at ~agw/class/os/share/proj3. But when I typed this into the terminal I keep getting a permission denied error message.

[lastname@erdos ~]$ ls
dead.letter Desktop Documents Downloads Music Pictures private Public public_html Templates Videos
[lastname@erdos ~]$ ~agw/class/os/share/proj3
/u/sobolev/agw/class/os/share/proj3: Permission denied.
[lastname@erdos ~]$

I've opened shared directories for this class before and had no issues.

View 2 Replies View Related

C++ :: Make Command In Bash Terminal

Nov 27, 2014

I've recently refreshed my mac by reinstalling the operating system. Uploaded the previous C and C ++ source scripts I was working with but when I go to compile them through the bash terminal it says command not found? Im not sure whats going because I thought that all the gcc files were already available? What am I messing here.

View 5 Replies View Related

C :: Check How Many Colors Terminal Supports

Feb 17, 2013

I'm generating all ncurses color pairs like this

Code:

void generate_all_color_pairs(){ int foreground;
int background;
int i = 0;
for(foreground=0; foreground<8; foreground++){
for(background=0; background<8; background++){
i++;

[code]....

but according on several sources, some terminals suport more colors.Is there any way to determine how many colors the current terminal supports?

View 3 Replies View Related

C/C++ :: Running Multiple Terminal In Xcode

Oct 5, 2014

I am using Xcode to do c++ programming and I have a c++ code, with different input arguments. I want to achieve that in Xcode, I could run multiple simultaneous running of my c++ code. However, the current problem is that once one code finishes, its terminal window automatically closed and I do not have time to look at its result. Thus computer time is wasted. Is there a way to run multiple same c++ code with different arguments input?

View 6 Replies View Related

C++ :: Compile With Terminal From MyProject Folder?

Apr 6, 2015

my folder structure looks like this:

Code:

MyProject
| |
header source
| |
Dog.h,Functions.h Functions.cpp, Dog.cpp, main.cpp

How can I compile and run this program (what do I have to type in terminal) - I would like to compile and run it from MyPoject's directory

Code:

cd MyProject

View 14 Replies View Related

C++ :: Make A Terminal For Website And BHXSpectre Recommended Cgi?

Nov 22, 2013

so i want to make a terminal for my website and BHXSpectre recommended cgi (which i love... c++ web design. just one more reason to not use any other language). anyways, im wondering how would i generate the html for the base of the terminal? ie just the window that i will be writing to

View 2 Replies View Related

C/C++ :: Creating Two Dimensional Terminal Based Game?

Apr 4, 2014

i am working on class project in which i have to save the tank from canon....imy tank is moving only when i press the moving key.. and after that i see blank screen what should i do to run my process when i am not pressing moving keys....

View 8 Replies View Related

C++ :: Make Terminal Screen Bigger In NCurses Program?

Jun 29, 2013

I wanted to make the terminal screen bigger in my NCurses program. Let's say if the defaults are 25 LINES and 80 COLS, I want to set them to 40 LINES and 120 COLS.

I've tried resizing all windows, but that did not work, because the actual terminal (console) was not resized. Then I found functions resizeterm and newterm, but they did not work. As far as my understanding goes resizeterm only updates NCurses information with the current configuration, while the window itself is not actually modified.

NCurses man page wrote:The function resizeterm resizes the standard and current windows to the specified dimensions

If I haven't made myself clear ( I sometimes make a mess of things... ), another example would be that I want my program to be fullscreen when I start it. Is this possible? It should be, I found a fullscreen NCurses program once, but the code was too confusing for me to understand.

Having read about things like SIGWINCH, I assume you must define a method for resizing the terminal screen yourself, I don't know where to start?

View 11 Replies View Related

C :: Count Lines In Input And Display Output In Terminal When Program Executed After Compilation

Feb 4, 2013

Code:

#include <stdio.h>
main() {
int c, n1;
n1 = 0;
while ((c = getchar()) != EOF)
if (c == '')
++n1;
printf("%d", n1);
}

I have a more complicated program I'm wishing to have display the output, however, to save some time I'm using an example of a shorter version. count the lines in input and display the output in terminal when ./program is executed after compilation. To count and compute lines, words and within arrays.

View 4 Replies View Related

C++ :: Absolute Path Reference - Open File And Print Contents To Terminal Window

May 12, 2014

I am trying to open a file and print the contents of the file to the terminal window. It works when I put the file right in the directory with the Solution but not if the file is out on my desktop and I use the full path. Here is the code:

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int OpenFile(){
fstream SampleFile;

[Code] .....

View 5 Replies View Related

C++ :: Assign Value To Interval

Oct 2, 2014

This is my code , i should Assign value val to interval [keyBegin, keyEnd).

#include <assert.h>
#include <map>
#include <limits>

void assign( K const& keyBegin, K const& keyEnd, const V& val ) {

if(!(keyBegin<keyEnd))

[Code] .....

View 7 Replies View Related

C++ :: Assign Value Dynamically?

Jun 18, 2013

I have array of pointers and when i tried to assign values dynamically all array items have the same value which is last value.

char* list[];
int DynamicDemo(void)
{

[Code].....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved