The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Build a Google Talk Client Using Oracle ADF Faces Rich Client and the Active Data Ser iBot Oracle Updates (RSS) 0 04-18-2008 03:10 PM
how to use fifo atticus High Level Programming 3 06-05-2006 07:15 AM
Does it require each x-client sould run in separate process? ps_sureshreddi UNIX Desktop for Dummies Questions & Answers 0 02-13-2005 11:29 PM
process executable file full path xtrix UNIX for Advanced & Expert Users 3 10-11-2004 01:28 AM
i want to pass the connect fd to child process,how can i do ti? hit High Level Programming 6 07-17-2002 11:45 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-18-2008
Registered User
 

Join Date: Mar 2008
Posts: 4
Stumble this Post!
How to pass FIFO path to client process ?

Hello everybody !

I have a first program, called "server" which build 2 FIFO's in this way:
Code:
...
#define PERMS 0666
#define FIFO1 "\tmp\cerere"
#define FIFO2 "\tmp\raspuns"
...
mkfifo(FIFO1, PERMS)
mkfifo(FIFO2, PERMS)
...
I want to access these FIFO's in a second separate program, called "client".
I tried to pass the FIFO's path in the client command line, like that:
Quote:
./client \tmp\cerere \tmp\raspuns
but when I tried to open the FIFO's the results were only "Error: No such file or directory."

This is how I transform the command line arguments in "client":
Code:
...
const char* FIFO1 = malloc(sizeof (argv[1]));
strncpy(FIFO1, argv[1], strlen(argv[1]));
const char* FIFO2 = malloc(sizeof (argv[2]));
strncpy(FIFO2, argv[2], strlen(argv[2]));
...
I tried another ways to pass the FIFO's path in the client command line, like that:
Quote:
./client /tmp/cerere /tmp/raspuns
Quote:
./client '\tmp\cerere' '\tmp\raspuns'
Quote:
./client '/tmp/cerere' '/tmp/raspuns'
Quote:
./client "\tmp\cerere" "\tmp\raspuns"
Quote:
./client "/tmp/cerere" "/tmp/raspuns"
I received same error.

If I defined directly the FIFO's path in the source code of "client", like that:
Code:
#define FIFO1 "\tmp\cerere"
#define FIFO2 "\tmp\raspuns"
the "client" works fine.

What is wrong ? May somebody help me ?
Thank you !
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-18-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,849
Stumble this Post!
One error:
Code:
// this should be
const char* FIFO1 = malloc(strlen (argv[1]));
strncpy(FIFO1, argv[1], strlen(argv[1]));
const char* FIFO2 = malloc(strlen (argv[2]));
strncpy(FIFO2, argv[2], strlen(argv[2]));
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0