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
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., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho