| Author |
Message |
girish
Guest
|
Posted:
Thu Oct 28, 2004 6:08 am Post subject:
ipcWriteProcess arguments. |
|
|
Is it possible to pass the value of a "variable" to the child process'
stdin using ipcWriteProcess()?
I am calling a child process inside a loop and would like to pass the
iteration number down to it.
for example, below is a portion of my OCEAN script:
while( i<5
id=ipcBeginProcess("ipc_test1")
ipcWriteProcess(id "***") ;*** I'D LIKE TO WRITE THE VALUE OF i HERE
ipcWait(id)
run()
selectResult( 'tran )
ocnPrint(?output myPort i("/Ipwl/PLUS"))
plot(getData("/Ipwl/PLUS") getData("/Vr") )
i++
)
ipcWriteProcess() seems to accepts only strings. Is there some other
function that will allow me to pass the value of variables? I have
just started with SKILL, so any pointers will be greatly appreciated.
Thanks.
Girish.
UVA
|
|
| Back to top |
|
 |
Suresh Jeevanandam
Guest
|
Posted:
Thu Oct 28, 2004 9:06 am Post subject:
Re: ipcWriteProcess arguments. |
|
|
You can write/read with the subprocess with strings only.
Do something like this,
ipcWriteProcess(id sprintf(nil, "%d", i))
If the type of variable is unknown, this would do,
ipcWriteProcess(id sprintf(nil, "%L", i))
Regards,
Suresh
girish wrote:
| Quote: | Is it possible to pass the value of a "variable" to the child process'
stdin using ipcWriteProcess()?
I am calling a child process inside a loop and would like to pass the
iteration number down to it.
for example, below is a portion of my OCEAN script:
while( i<5
id=ipcBeginProcess("ipc_test1")
ipcWriteProcess(id "***") ;*** I'D LIKE TO WRITE THE VALUE OF i HERE
ipcWait(id)
run()
selectResult( 'tran )
ocnPrint(?output myPort i("/Ipwl/PLUS"))
plot(getData("/Ipwl/PLUS") getData("/Vr") )
i++
)
ipcWriteProcess() seems to accepts only strings. Is there some other
function that will allow me to pass the value of variables? I have
just started with SKILL, so any pointers will be greatly appreciated.
Thanks.
Girish.
UVA |
|
|
| Back to top |
|
 |
S. Badel
Guest
|
Posted:
Thu Oct 28, 2004 11:55 am Post subject:
Re: ipcWriteProcess arguments. |
|
|
Yes, you could also pass it as a command-line parameter
id=ipcBeginProcess( sprintf( nil "ipc_test1 %d" i ) )
just a note, i think you should call ipcWaitForProcess( id )
before starting to send data to make sure the process is
ready for communication.
cheers,
stephane
girish wrote:
| Quote: | Is it possible to pass the value of a "variable" to the child process'
stdin using ipcWriteProcess()?
I am calling a child process inside a loop and would like to pass the
iteration number down to it.
for example, below is a portion of my OCEAN script:
while( i<5
id=ipcBeginProcess("ipc_test1")
ipcWriteProcess(id "***") ;*** I'D LIKE TO WRITE THE VALUE OF i HERE
ipcWait(id)
run()
selectResult( 'tran )
ocnPrint(?output myPort i("/Ipwl/PLUS"))
plot(getData("/Ipwl/PLUS") getData("/Vr") )
i++
)
ipcWriteProcess() seems to accepts only strings. Is there some other
function that will allow me to pass the value of variables? I have
just started with SKILL, so any pointers will be greatly appreciated.
Thanks.
Girish.
UVA |
|
|
| Back to top |
|
 |
fogh
Guest
|
Posted:
Thu Oct 28, 2004 7:27 pm Post subject:
Re: ipcWriteProcess arguments. |
|
|
girish wrote:
| Quote: | Is it possible to pass the value of a "variable" to the child process'
stdin using ipcWriteProcess()?
I am calling a child process inside a loop and would like to pass the
iteration number down to it.
for example, below is a portion of my OCEAN script:
while( i<5
id=ipcBeginProcess("ipc_test1")
ipcWriteProcess(id "***") ;*** I'D LIKE TO WRITE THE VALUE OF i HERE
ipcWait(id)
run()
selectResult( 'tran )
ocnPrint(?output myPort i("/Ipwl/PLUS"))
plot(getData("/Ipwl/PLUS") getData("/Vr") )
i++
)
ipcWriteProcess() seems to accepts only strings. Is there some other
function that will allow me to pass the value of variables? I have
just started with SKILL, so any pointers will be greatly appreciated.
|
MyDebugMode=not(())
S="*"
S=sprintf(nil "%s*" S)
S=strcat(S "*" "\n" sprintf(nil "%L" i))
ipcWriteProcess(id S)
MyDebugMode&&info("I just sent %L to %L by IPC." S id) |
|
| Back to top |
|
 |
girish
Guest
|
Posted:
Fri Oct 29, 2004 1:22 am Post subject:
Re: ipcWriteProcess arguments. |
|
|
yeah!!! it works!
thanks so much suresh and stephane. both the ipcWriteProcess() and
command line solutions work great using sprintf()!
I'll make sure to insert the ipcWaitForProcess(id) after invoking a
process and before communicating with it. thanks again stephane.
Girish.
UVA
"S. Badel" <stephane.badel@REMOVETHISepfl.ch> wrote in message news:<4180a5fa$1@epflnews.epfl.ch>...
| Quote: | Yes, you could also pass it as a command-line parameter
id=ipcBeginProcess( sprintf( nil "ipc_test1 %d" i ) )
just a note, i think you should call ipcWaitForProcess( id )
before starting to send data to make sure the process is
ready for communication.
cheers,
stephane
girish wrote:
Is it possible to pass the value of a "variable" to the child process'
stdin using ipcWriteProcess()?
I am calling a child process inside a loop and would like to pass the
iteration number down to it.
for example, below is a portion of my OCEAN script:
while( i<5
id=ipcBeginProcess("ipc_test1")
ipcWriteProcess(id "***") ;*** I'D LIKE TO WRITE THE VALUE OF i HERE
ipcWait(id)
run()
selectResult( 'tran )
ocnPrint(?output myPort i("/Ipwl/PLUS"))
plot(getData("/Ipwl/PLUS") getData("/Vr") )
i++
)
ipcWriteProcess() seems to accepts only strings. Is there some other
function that will allow me to pass the value of variables? I have
just started with SKILL, so any pointers will be greatly appreciated.
Thanks.
Girish.
UVA |
|
|
| Back to top |
|
 |
|
|
|
|