Posts: 42
Threads: 14
Joined: Dec 2004
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]
Posts: 3,279
Threads: 170
Joined: Nov 2003
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.
Posts: 594
Threads: 11
Joined: Oct 2002
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
Posts: 42
Threads: 14
Joined: Dec 2004
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.
Posts: 1,439
Threads: 15
Joined: Apr 2003
use something like this before using CRLF:
Code:
dim shared CRLF as string
CRLF = chr$(13) + chr$(10)
Posts: 393
Threads: 44
Joined: Mar 2004
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/
Posts: 3,279
Threads: 170
Joined: Nov 2003
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.
Posts: 42
Threads: 14
Joined: Dec 2004
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.
Posts: 3,279
Threads: 170
Joined: Nov 2003
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..).
I'd knock on wood, but my desk is particle board.