08-24-2005, 05:27 AM
I am finding that PRINT USING does not work very well with user data types in FB. Specifically, printing string variables to occupy a certain number of spaces regardless of length.
If you use normal variables, it works fine, like this:
Print Using "\ \ 12345";"ab"
Print Using "\ \ 12345";"abcd"
Input "Hit Enter to end",a$
On both lines the 12345 line up right under each other, even though the two strings are different lengths. Just as Print Using is supposed to do.
But if you do it this way:
Type info
firstname As String *10
End Type
Dim person1 As info
Dim person2 As info
person1.firstname="Jim"
person2.firstname="Charles"
Print Using "\ \ Smith";person1.firstname
Print Using "\ \ Smith";person2.firstname
Input "Hit Enter to end",a$
..the two "Smith"'s do NOT line up above each other, as they should. Even though the backslash characters should cause the user data type string variables to print in the same space, they don't. The different length seems to create some sort of problem.
This never occurred under QuickBasic. Does anyone know why this is happening?
If you use normal variables, it works fine, like this:
Print Using "\ \ 12345";"ab"
Print Using "\ \ 12345";"abcd"
Input "Hit Enter to end",a$
On both lines the 12345 line up right under each other, even though the two strings are different lengths. Just as Print Using is supposed to do.
But if you do it this way:
Type info
firstname As String *10
End Type
Dim person1 As info
Dim person2 As info
person1.firstname="Jim"
person2.firstname="Charles"
Print Using "\ \ Smith";person1.firstname
Print Using "\ \ Smith";person2.firstname
Input "Hit Enter to end",a$
..the two "Smith"'s do NOT line up above each other, as they should. Even though the backslash characters should cause the user data type string variables to print in the same space, they don't. The different length seems to create some sort of problem.
This never occurred under QuickBasic. Does anyone know why this is happening?