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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. ExpectTheUnexpected

    Inheritance and termination housekeeping

    // Base class declaration class CEmployee { public: CEmployee(char* f, char* l, int salary); CEmployee(int s); ~CEmployee(void); int getSalary(); int age; protected: char* fname; char* lname; int salary; }; // Derived...
  2. ExpectTheUnexpected

    Forcing CR in output

    If you are using Expect, you can try send_user command.
  3. ExpectTheUnexpected

    Forcing CR in output

    Shot in the dark, but have you tried: puts -nonewline "$channel ATMY\x0d" and maybe: flush $channel
  4. ExpectTheUnexpected

    tk installation problem/ tcl configurations

    I am not familiar with Ubuntu & source code installations. If you just care to install tcl/tk, other forums seem to suggest this: sudo apt-get tcl tk Other option is downloading binaries from: www.ActiveState.com/activetcl/downloads Unzip the tar. Run install.sh from the directory where you...
  5. ExpectTheUnexpected

    cant open serial port with [open /dev/ttyS0 r+]

    Primilinary search indicates to me that TCL maynot be sufficient to open usb port. You may have to look into writing C/C++ code to accmplish that. For Unix, you have to use open, read, close etc. file functions to read usb port. For example, under Unix you can run command "man 2 read" to...
  6. ExpectTheUnexpected

    cant open serial port with [open /dev/ttyS0 r+]

    In Linux, everything is a file. The /dev directory is part of Linux OS architecture containing special device files that allow for user applications to interface with hardware. This mechanism of communicating with devices does not exist on MS Windows which you are trying to do. I have used...
  7. ExpectTheUnexpected

    Expect Package breaking good ole 'puts'???

    No problems here running above script in bash shell w/ and w/o "package require Expect".
  8. ExpectTheUnexpected

    comparing element in a list

    You can sort the list with or without hex elements (0x30A) as shown in the response code sample above. what happen if my list is i get from a database which i set it to foreach part $partno{ set count "" set count [<command> $partno] } It is hard to infer what you are trying to do from your...
  9. ExpectTheUnexpected

    Run Tcl script in command prompt with Active Tcl and Win

    Do you have TCL installed? You can set the PATH in Windows to point to TCL intrepreter or explicitly type the path when running scripts, i.e, \path\to\tclsh.exe \script\lives\here\tcl_script.tcl You can also set file association in Windows so when a script name is entered Windows know to call...
  10. ExpectTheUnexpected

    TCL that calls C++ code

    Glad to hear it is working for you. You are welcome.
  11. ExpectTheUnexpected

    TCL that calls C++ code

    Hmm. I think I understand your concern. Change the code as follows: set a1 "Hello" set a2 "there" set a3 "UchihaItachi!!!" set status [catch {exec /path/to/exe/cpp_app.exe "\$a1" $a1 "\$a2" $a2 "\$a3" $a3} result] puts "$result" if {$status} { puts "cpp_app error: $status} Notice now...
  12. ExpectTheUnexpected

    TCL that calls C++ code

    You have to compile C/C++ code. You have to include iostream header. I had to install C++ compiler using yum. I ran above script code with TCL interpreter with no problems. Good luck
  13. ExpectTheUnexpected

    TCL that calls C++ code

    It looks like you have incorrect syntax. Your code is wrong! if ([catch (exec / path / to / exe / cpp_app.exe $ a1 $ a2 $ a3)]) ( if ([lIndex $:: errorCode 2] eq "1") ( puts "cpp_app.exe error: [lIndex $:: errorCode 2] Else () # Something else went wrong ) ) What language...
  14. ExpectTheUnexpected

    How to read variable value present in one .tcl file from another .tcl

    You can check how procedure p1 modified flag in file1. Updated file2.tcl: # calls ONLY procedure p1 w/ 2 arguments in file1! set flag [p1 10 20] puts "flag in file2: $flag"
  15. ExpectTheUnexpected

    How to read variable value present in one .tcl file from another .tcl

    What in the world are you trying to do? If variable flag is constant then why not set it in file2? If flag is being manipulated and modified then file1 must execute!!! It seems you may need to modularize file1. By that I mean, you need to create procedures that do very specific tasks in...
  16. ExpectTheUnexpected

    How to read variable value present in one .tcl file from another .tcl

    Feherke illustrated what I understood as well. But maybe you mean this? file1.tcl: set flag 1234 set output [exec tclsh /path/to/file2.tcl $flag] puts stdout $output file2.tcl: set argc [llength $argv] if {$argc < 1} { puts "Too few arguments" exit } # Assuming flag is the first argument...
  17. ExpectTheUnexpected

    TCL that calls C++ code

    Few key notes about my first response... Typo fix: cout << "Arg " << i << ":" << *argv[i] << endl; The line above should be: cout << "Arg " << i << ":" << argv[i] << endl; Script code is in Expect lanugage. You maybe writing in TCL but idea is the same. Line below can send script...
  18. ExpectTheUnexpected

    TCL that calls C++ code

    I am not sure if I understand your request correctly. As I I understand, this is what you are trying to do. C/C++ code: void somefunc(int argc, char* argv[]) { int i = 1; while(i < argc) { cout << "Arg " << i << ":" << *argv[i] << endl; i++; } } int main(int argc...
  19. ExpectTheUnexpected

    Expect multi-proc interaction

    I am trying to figure out how Expect's interact command works with multiple processes. I have 2 simple scripts below. The objective is to feed output by spawned process id2 to spawned process id1. #!/usr/bin/expect -- log_user 1 # clear screen send_user [exec tput reset] # it appears...
  20. ExpectTheUnexpected

    Tcl: retrive fileName from fileId

    A driver? :0| What are you trying to do? To monitor changes to a file, you don't really need a driver. For example, in Windows you can interface to Operating System's supplied API to monitor file changes. I am new to Linux but I am pretty sure there are mechanisms to accomplish the same...

Part and Inventory Search

Back
Top