Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
help needed

Posted by gurudatt (gurudatt), 19 February 2008
Hello,

i am logging the output from the console to a file. it is giving some strange output in the logged file.

Code:

set fh [open log.txt w+]

while  $running {
           expect {
                  "\n" { puts -nonewline $fh $expect_out(buffer)
                          set h $expect_out(buffer)
                          flush $fh }
                          flush (stdout)
                          -re "->" { break }
                  eof {set running 0}
                  timeout {set running 0}
                  }
         }
close $fh

Console output:

envShow
(global environment)
0: CPU_FREQUENCY=601352411
1: BOARD_TYPE=GITANEMEM
2: IP_BOARD_TYPE=NONE
3: ETHERNET_BOARD=FEI
4: FCIB_BOARD=NONE
5: RTAC_MEMORY_SIZE=128
6: ATA_SERIAL_NUMBER=5EG270CC            
7: ATA_REVISION_NUMBER=3.02    
8: ATA_MODEL_NUMBER=ST310212A                              
9: NETWORK_IF_NAME=fei0
10: TSC_TIME_FROM_RESET=33.030684 seconds
11: OSAGENT_PORT=14000
12: SSEXEC_LOAD_FILE=/c/prod/engcfg/ssload.cfg
13: SUBNET_MASK=0xffff0000
14: BROADCAST_ADDRESS=3.235.119.255
15: ATL_PATCH_MALLOC=1
16: ATL_NEW_HEAP_SIZE=80
value = 25 = 0x19

Logged output:

envShow
(global environment)
0: CPU_FREQUENCY=601352411
1: BOARD_TYPE=GITANEMEM
2: IP_BOARD_TYPE=NONE
3: ETHERNET_BOARD=FEI
4: FCIB_BOARD=NONE
5: RTAC_MEMORY_SIZE=128
6: ATA_SERIAL_NUMBER=5EG270CC            
7: ATA_REVISION_NUMBER=3.02    
8: ATA_MODEL_NUMBER=ST310212A                              

9: NETWORK_IF_NAME=fei0
10: TSC_TIME_FROM_RESET=33.030684 seconds
11: OSAGENT_PORT=14000
12: SSEXEC_LOAD_FILE=/c/prod/engcfg/ssload.cfg
13: SUBNET_MASK=0xffff0000
14: BROADCAST_ADDRESS=3.235.119.255
15: ATL_PATCH_MALLOC=1
16: ATL_NEW_HEAP_SIZE=80
value = 25 = 0x19

Q: Can you tell me as to why i am getting a newline after 8: ?

Posted by admin (Graham Ellis), 19 February 2008
Does the environment variable shown in line 8 have a \r on the end of it

Posted by gurudatt (gurudatt), 20 February 2008
I dont think so there is a \r

Posted by admin (Graham Ellis), 20 February 2008
Sorry - I don't follow that.   The first half of your reply says "no" and the second half says "yes" to me.

Have a look at the outputs through "od -x" or "od -c" and see what characters you've actually got.

Posted by gurudatt (gurudatt), 21 February 2008
I am sorry but can you tell me as to how i should use this. Working on the windows platform.

Posted by admin (Graham Ellis), 21 February 2008
Either FTP the output across to a Linux of Unix system, or use Cygwin.  You could also use an editor that shows you control codes, or have your Tcl script decode the bytes.  Plenty of choices!



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho