Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Questions about BINARY and color
#1
1. When writing into a binary file, how do I make each entry on a seperate line when I view it in notepad? Example:

Code:
variable$ = "A"
elbairav$ = "Z"

PUT #1, 1, variable$
PUT #1, 2, elbairav$

Then it appears like this:

AZ

But I want it to appear like this:

A
Z

How do I do so?

2. Is there a way to detect the color of a text character?

[/code]
Reply
#2
Place a CRLF sequence into the file where you want the line broken. CR is Chr$(13) and LF is Chr$(10).
I'd knock on wood, but my desk is particle board.
Reply
#3
If you mean the color of a text-character on the screen, this might help: http://qbasicnews.com/qboho/qckadvr.screenf.shtml
B 4 EVER
Reply
#4
Quote:Place a CRLF sequence into the file where you want the line broken. CR is Chr$(13) and LF is Chr$(10).

Can you explain that a little but furthur? I tried putting:

PUT #1, , CRLF

after another PUT but all it did was add a few spaces. And thanks ak00ma that works great.
Reply
#5
use something like this before using CRLF:

Code:
dim shared CRLF as string
CRLF = chr$(13) + chr$(10)
Reply
#6
CRLF := Carriage Return, Line feed. These are two special characters with the ASCII code of 13 and 10. So you can get the string what acts as a new line by creating it from these two characters as the others said above.
(CHR$ returns one character wich has the ASCII code passed as it's parameter)
fter 60 million years a civilization will search for a meteorite destroying most of the living creatures around this age...

There must be a better future for the Cheetahs!

http://rcs.fateback.com/
Reply
#7
Quote:Can you explain that a little but furthur? I tried putting:

PUT #1, , CRLF

after another PUT but all it did was add a few spaces. And thanks ak00ma that works great.
I thought the fact that I added the two Chr$ lines was hint enough but...
I'd knock on wood, but my desk is particle board.
Reply
#8
Is there any alternative of SCREEN for getting the color of a text character? I'm sure there is a method involving PEEK but I don't understand it that much at the moment.
Reply
#9
PEEK is the only other way, unless you have an array that you use to keep track of such things...of course, that makes such a very simple concept horribly over complicated, so you're better off either using SCREEN or PEEK. To use PEEK, you have to know where the screen is (it's at &HB800 for textmode) and then how to read memory (for textmode, memory is divided into two bytes per screen cell: one is for the character and one is for the color, but right now I can't remember which order they,re in...do some trial and error and you'll be able to figure it out..). Big Grin
I'd knock on wood, but my desk is particle board.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)