Code: Select all
INPUT "File to read from: ", infile$
INPUT "File to output to: ", outfile$
OPEN infile$ FOR INPUT AS #1
OPEN outfile$ FOR APPEND AS #2
DO
temp$ = ""
sep! = 0
ans$ = ""
que$ = ""
INPUT #1, temp$
cnt! = cnt! + 1
sep! = INSTR(temp$, "|")
ans$ = LEFT$(temp$, sep! - 1)
que$ = RIGHT$(temp$, sep! + 1)
PRINT sep! 'not really need; for debugging only
PRINT ans$ 'not really need; for debugging only
PRINT que$ 'not really need; for debugging only
PRINT #2, sep! 'not really need; for debugging only
PRINT #2, que$ + "?" + "*" + ans$
LOOP UNTIL EOF(1) = -1
CLOSE #2
CLOSE #1
PRINT "All finished!"
answer|question
hijklmnop|abcdefg
zsdx|adsd
67890|12345
efghgg|abcdff
Output file...
9
r|question?*answer
16
hijklmnop|abcdefg?*hijklmnop
7
sdx|adsd?*zsdx
6
0|12345?*67890
7
g|abcdff?*efghgg