ipcWriteProcess arguments.

G

girish

Guest
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
 
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:
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
 
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
 
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.
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)
 
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>...
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
 

Welcome to EDABoard.com

Sponsor

Back
Top