Login
Forum Help



Post Your Message
="hidden" name="cat" value="Programming">
Username: (Login)

Topic:
Message:
 


Previous Messages
Posted By

JamesC
on 2018-02-28
10:54:02
 Re: Use of spaces in INPUT#/PRINT# statements

The initial space is written to disk. INPUT# fails to capture leading spaces from disk (just as INPUT fails to capture leading spaces from the keyboard).

Test program:
10 REM : PRINT# / INPUT# TEST
20 A$ = CHR$(32) + "ABCDE" : REM ENSURE SPACE PRECEEDS LETTERS
30 OPEN8,8,8,"PRINT/INPUT TEST,S,W"
40 PRINT#8,A$
50 PRINT#8," FGHIJ " : REM SPACE BEFORE AND AFTER LETTERS
60 PRINT#8,"KLMNO" : REM NO SPACES
70 CLOSE8
80 OPEN5,8,5,"PRINT/INPUT TEST,S,R"
90 INPUT#5,T1$
100 INPUT#5,T2$
110 INPUT#5,T3$
120 CLOSE 5
130 PRINTT1$,LEN(T1$)
140 PRINTT2$,LEN(T2$)
150 PRINTT3$,LEN(T3$)

Results:



Posted By

SVS
on 2018-02-28
08:43:50
 Use of spaces in INPUT#/PRINT# statements

I would to clarify this argument in order to update the next release of the UltimateMap.
As we know, if a string begins with spaces, it is automatically normalized stripping off the initial spaces. For ex. " ABC" will be retrieved as "ABC".

What I ask you is a confirmation (if somebody has verified with proper tests) if the stripping is done when INPUT# reads the string, or by PRINT# when it saves the string. In other hand, inside the file the string is stored normalized or original?


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon