[Gambas-user] Exec & Standard Output
John Rose
john.aaron.rose at ...626...
Tue Feb 24 10:05:36 CET 2015
When I run a CLI program (which I didn't write) in Terminal, lines are
displayed as I would hope in terms of line feeds:
john at ...2811...:~$ /opt/Enigma/turing_bombe_all_wheels
'Temporary/Enigma/FHPQX Menu3.txt' 5
#########################################
Switches defined:
GPU=0
SOFTWARE_MODE
NO_RECURSIVE
SAFECODE=1
#########################################
Memory to store stops: 360000 bytes
You are using single-core
-------------------------------
Menu loaded (12 connection(s))
Register: E (A)
AAA
AAB
AAC
AAD
AAE
AAF
AAG
AAH
AAI
AAJ
AAK
AAL
A --> I (0)
D --> R (2)
D --> G (11)
E --> F (1)
E --> Q (5)
E --> G (6)
E --> R (8)
E --> K (10)
F --> E (1)
F --> S (7)
G --> E (6)
G --> D (11)
H --> S (3)
I --> A (0)
I --> S (4)
I --> R (9)
K --> E (10)
Q --> E (5)
R --> D (2)
R --> E (8)
R --> I (9)
S --> H (3)
S --> I (4)
S --> F (7)
-------------------------------
STOP at: RDI E:L (AI:BH:DT:EL:FU:GW:MR:NQ:OS)
STOP at: BGD E:K (AS:DV:EK:FX:GP:IW:JR:NQ)
STOP at: SMH E:G (AW:BF:DV:EG:HX:KN:LS:PR:QY)
STOP at: MJR E:X (AB:DL:EX:FY:GM:HT:IP:JK:OQ:RZ:SW)
STOP at: NNI E:H (AD:EH:GY:IM:KN:LR:QV)
STOP at: ZSB E:X (BI:CR:DV:EX:FZ:GL:HQ:KW:NS)
STOP at: QZF E:Z (AL:BR:DM:EZ:GU:HO:IS:QW)
STOP at: NJJ E:N (AW:BH:CK:DZ:EN:FS:GP:IJ:QV:RU)
STOP at: RIV E:N (AL:BD:CK:EN:FP:GV:HU:IO:MQ:RY:SZ)
STOP at: BGS E:B (AR:BE:CH:DP:FW:GM:IT:QX:SY)
STOP at: LVT E:C (CE:FP:GW:IU:JK:LQ:NS:RT)
STOP at: PDA E:V (AX:BG:CI:DP:EV:FU:HM:KL:OQ:RY:SZ)
STOP at: UBP E:T (AY:BH:ET:FV:GW:IZ:LQ:NS)
STOP at: DSZ E:C (AU:CE:DH:FL:KX:NS:QY:RT)
STOP at: XAC E:M (AU:BF:CI:DV:EM:GK:HL:OS:QX:RT)
STOP at: KHJ E:J (AV:BD:CS:EJ:HP:IK:QX:RZ)
STOP at: VUQ E:M (DG:EM:FU:HP:IL:KY:QZ:RX:SW)
STOP at: MSY E:M (AW:CF:DJ:EM:GP:HO:IL:KV:QY:RX:ST)
STOP at: NUI E:N (AH:DW:EN:FO:GJ:IP:KV:MR:QY:SX)
PRINT ALL STOPS:
1 1 4 3 RDI E:L
1 1 5 4 BGD E:K
1 2 3 5 SMH E:G
1 4 2 1 MJR E:X
1 4 2 3 NNI E:H
1 4 2 5 ZSB E:X
1 4 3 1 QZF E:Z
1 5 3 4 NJJ E:N
2 1 3 4 RIV E:N
2 2 1 3 BGS E:B
2 2 4 3 LVT E:C
2 2 4 3 PDA E:V
2 3 1 2 UBP E:T
2 3 1 4 DSZ E:C
2 3 4 1 XAC E:M
2 4 1 5 KHJ E:J
2 5 2 1 VUQ E:M
2 5 2 3 MSY E:M
2 5 4 2 NUI E:N
Total 19 stops
Total 120 wheel orders processed
Bombe running time total: 11.314253 seconds
When I run a Gambas app calling that CLI program (with same parameters
as in Terminal), there seem to be very long lines with resultant line
feeds at odd places. The results shown below are from the 'Print "SO=" &
sLine' command shown in the code fragment later:
SO=#########################################
Switches defined:
GPU=0
SOFTWARE_MODE
NO_RECURSIVE
SAFECODE=1
#########################################
Memory to store stops: 360000 bytes
You are using single-core
-------------------------------
Menu loaded (12
SO=connection(s))
Register: E (A)
AAA
AAB
AAC
AAD
AAE
AAF
AAG
AAH
AAI
AAJ
AAK
AAL
A --> I (0)
D --> R (2)
D --> G (11)
E --> F (1)
E --> Q (5)
E --> G (6)
E --> R (8)
E --> K (10)
F --> E (1)
F --> S (7)
G --> E (6)
G --> D (11)
H --> S (3)
I --> A (0)
I -->
SO=S (4)
I --> R (9)
K --> E (10)
Q --> E (5)
R --> D (2)
R --> E (8)
R --> I (9)
S --> H (3)
S --> I (4)
S --> F (7)
-------------------------------
STOP at: RDI E:L (AI:BH:DT:EL:FU:GW:MR:NQ:OS)
STOP at: BGD E:K (AS:DV:EK:FX:GP:IW:JR:NQ)
STOP at: SMH
SO= E:G (AW:BF:DV:EG:HX:KN:LS:PR:QY)
STOP at: MJR E:X (AB:DL:EX:FY:GM:HT:IP:JK:OQ:RZ:SW)
STOP at: NNI E:H (AD:EH:GY:IM:KN:LR:QV)
STOP at: ZSB E:X (BI:CR:DV:EX:FZ:GL:HQ:KW:NS)
STOP at: QZF E:Z (AL:BR:DM:EZ:GU:HO:IS:QW)
STOP at: NJJ E:N
SO=(AW:BH:CK:DZ:EN:FS:GP:IJ:QV:RU)
STOP at: RIV E:N (AL:BD:CK:EN:FP:GV:HU:IO:MQ:RY:SZ)
STOP at: BGS E:B (AR:BE:CH:DP:FW:GM:IT:QX:SY)
STOP at: LVT E:C (CE:FP:GW:IU:JK:LQ:NS:RT)
STOP at: PDA E:V (AX:BG:CI:DP:EV:FU:HM:KL:OQ:RY:SZ)
STOP at: UBP E:
SO=T (AY:BH:ET:FV:GW:IZ:LQ:NS)
STOP at: DSZ E:C (AU:CE:DH:FL:KX:NS:QY:RT)
STOP at: XAC E:M (AU:BF:CI:DV:EM:GK:HL:OS:QX:RT)
STOP at: KHJ E:J (AV:BD:CS:EJ:HP:IK:QX:RZ)
STOP at: VUQ E:M (DG:EM:FU:HP:IL:KY:QZ:RX:SW)
STOP at: MSY E:M (AW:CF
SO=:DJ:EM:GP:HO:IL:KV:QY:RX:ST)
STOP at: NUI E:N (AH:DW:EN:FO:GJ:IP:KV:MR:QY:SX)
PRINT ALL STOPS:
1 1 4 3 RDI E:L
1 1 5 4 BGD E:K
1 2 3 5 SMH E:G
1 4 2 1 MJR E:X
1 4 2 3 NNI E:H
1 4 2 5 ZSB E:X
1 4 3 1 QZF E:Z
1 5 3 4 NJJ E:N
2 1 3 4 RI
SO=V E:N
2 2 1 3 BGS E:B
2 2 4 3 LVT E:C
2 2 4 3 PDA E:V
2 3 1 2 UBP E:T
2 3 1 4 DSZ E:C
2 3 4 1 XAC E:M
2 4 1 5 KHJ E:J
2 5 2 1 VUQ E:M
2 5 2 3 MSY E:M
2 5 4 2 NUI E:N
Total 19 stops
Total 120 wheel orders processed
Bombe running time tot
SO=al: 12.109768 seconds
Code fragments:
aExecParameters = ["/opt/Enigma/turing_bombe_all_wheels", sMenuPath]
pturing_bombe = Exec aExecParameters Wait For Read As
"TuringBombeResultsDetail"
Public Sub TuringBombeResultsDetail_Read()
' when turing_bombe sends a results detail line to Standard Output
Dim sLine As String
Read #Last, sLine, -256
Print "SO=" & sLine
With ResultsDetailTextArea
.Text &= sLine & "\n"
.Refresh
End With
Print #fResults, sLine
Catch
Message.Warning("Error displaying standard output in
ResultsDetailTextArea:\n" & ERROR.Text)
End
I think that it's something to do with -256 in the Read command above.
How do I correct this coding to do the same as running the CLI program
in Terminal?
--
John
More information about the User
mailing list