Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading the data array from Tcl/Tk to C

Status
Not open for further replies.

Silentkiller

Technical User
Feb 13, 2003
14
0
0
GB
Hi
I managed to open an image file in Tcl/Tk. How can i read the data arrays of the images into C program? Please enlighten me. Thanx!

With Regards
S C Ho
 
Do you need complicated IPC(shared memory type thing) or do you need a simple pipe?

Code:
proc feedData {pname adata num} {
upvar $adata local
#open the program for read/write
   if {[catch {set phandle [open "| $pname" r+]} err_out]} {
        puts $err_out
        return -1
      }

#read the numerically ordered array into the listening
#programs input
     for {set x 1} {$x <= $num} {incr x} {
          puts $phandle $local($x)
     }
catch {close $phandle}
}

Other simple options include using sockets.
OTOH:
If you need a shared memory or sophisticated
C intensive approach I would try comp.lang.tcl.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top