Max String Length & File Output

Nelda
07-19-2003, 01:10 PM
I got bored so I wrote a program that writes bitmap files. The problem is that VB insists on putting a carriage return/line feed (chr(13) and chr(10)) after every print function.

Luckily for me, bitmap files have 2 unused spaces at the end, so I just put the entire bmp data into a string, then print it all at once.


So is there any way to force VB to just output what i want, with no extras?

also, on a somewhat related note, what's the maximum length of a string? I've done some searching, and I can't find that info anywhere. A friend of mine says it's whatever the max value of a long is (can't think of it off the top of my head).

Mukunda51
07-19-2003, 01:19 PM
im not sure about bitmaps and stuff but the max value of a long is:
2147483647
longs are 4 bytes so you can open up your windows calculator set it to scientific, turn on binary and type 11111111111111111111111111111111 because each of those 1's is a bit and 8 bits make a byte and 4 bytes, that makes 32 1's (for maximum value) then divide that by 2 (ignore the decimal point, the decimal value is ignored but the negative max value is one more then the positive one) and then you have the max value.

passel
07-19-2003, 01:36 PM
I got bored so I wrote a program that writes bitmap files. The problem is that VB insists on putting a carriage return/line feed (chr(13) and chr(10)) after every print function.

Luckily for me, bitmap files have 2 unused spaces at the end, so I just put the entire bmp data into a string, then print it all at once.


So is there any way to force VB to just output what i want, with no extras?

also, on a somewhat related note, what's the maximum length of a string? I've done some searching, and I can't find that info anywhere. A friend of mine says it's whatever the max value of a long is (can't think of it off the top of my head).

To not print the CR/LF do:
Print a$;
The semi-colon suppress the CR/LF

If you do this:
Print a$,
then a tab is added to the end of the string.

The reason is for simple formating.

If i want to print several strings on the same line I can do this.
Print a$;b$;c$

if i want to print in columns then
Print a$,b$,c$

A plain Print will always add the cr/lf so that you next print will go on
a new line.

bpd
07-19-2003, 01:39 PM
I got bored so I wrote a program that writes bitmap files. The problem is that VB insists on putting a carriage return/line feed (chr(13) and chr(10)) after every print function.

[...]

So is there any way to force VB to just output what i want, with no extras?Try terminating the Print command with a semi-colon (";").

also, on a somewhat related note, what's the maximum length of a string? I've done some searching, and I can't find that info anywhere. A friend of mine says it's whatever the max value of a long is (can't think of it off the top of my head).According to the MSDN: "The String data type can store fixed-length strings ranging in length from 0 to approximately 63K characters and dynamic strings ranging in length from 0 to approximately 2 billion characters."

Nelda
07-19-2003, 01:50 PM
*smacks forehead* duh...

I knew that when i used FutureBASIC...

I knew that when i used QBASIC...

somehow, it never occurred to me to use it in VB.


thanks guys.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum