01-09-2005, 08:36 AM
Which manual do you refer to? I never find a useful manual within the latest fbc release, not to say an up-to-date manual. Do you all surf the internet for document while programming? I suggest to put documents on http://fbc.sourceforge.net/about.php into the zippd file- even if they are lack of update.
Another topic. Here is a code segment
qb gives
I find
on http://fbc.sourceforge.net/about.php?section=diffs. so is the answer
?
No! The real answer is
First, is there anyone can explain what does LEN(UDT) mean in QB and fbc, and why is LEN(UDT) not equal to LEN(UDT var), (in C, sizeof(UDT)==sizeof(UDT var), right?) ?
No, please do not misunderstand me and do not fix the LEN function. I do not like the way that C treates string( chr$(0) is only used to end a string), so can you let fbc be more Qb-ish by fixing PRINT, and fix LEN on UDT and UDT-var for the Qb-ish reason and consistant reason( len(integer)=4 in fbc)?
thank you.
Another topic. Here is a code segment
Code:
a$ = "hello" + CHR$(0) + "world"
PRINT "a$="; a$, "len(a$)="; LEN(a$)
b$ = LEFT$(a$, 5) + RIGHT$(a$, 5)
PRINT "b$="; b$, "len(b$)="; LEN(b$)
PRINT LEN("hello")
TYPE u
q AS INTEGER
w AS STRING * 5
END TYPE
DIM r AS u
PRINT "len of type u="; LEN(u)
PRINT "len of r="; LEN(r)
Quote:a$=hello world len(a$)= 11so guess what does fbc say?
b$=helloworld len(b$)= 10
5
len of type u= 4 <- why is it 4 other than 7?
len of r= 7
I find
Quote:FB: Real length is the given len plus one (null-char), even on TYPE fields
Strings are filled with nulls (char 0), so strings can't contain chr$(0) chars
on http://fbc.sourceforge.net/about.php?section=diffs. so is the answer
Quote:a$=hello len(a$)= 6 <- given len+1=6, well perhaps your answer is 5
b$=hellohello len(b$)= 10
5
len of type u= ?? <- I can not think it out.
len of r= 10
?
No! The real answer is
Quote:a$=hello len(a$)= 11the "hello" on 1st line meets "strings can't contain chr$(0) chars", but len(a$) and the 2nd line say that it is wrong.
b$=helloworld len(b$)= 10
5
len of type u= 12
len of r= 10 <- 4+5+len of padding 0?
First, is there anyone can explain what does LEN(UDT) mean in QB and fbc, and why is LEN(UDT) not equal to LEN(UDT var), (in C, sizeof(UDT)==sizeof(UDT var), right?) ?
No, please do not misunderstand me and do not fix the LEN function. I do not like the way that C treates string( chr$(0) is only used to end a string), so can you let fbc be more Qb-ish by fixing PRINT, and fix LEN on UDT and UDT-var for the Qb-ish reason and consistant reason( len(integer)=4 in fbc)?
thank you.