Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / string output - HELP!!

Author
Message
Bmad6
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: Virginia, United States
Posted: 5th Sep 2005 04:40
is it possible to ouput a string to a file of greater length than 255 characters?

or, is it possible to output a string to a file without the carriage return?

you see, I need to output strings of 748 characters followed by two carriage returns to a file repeatedly.

The program that inputs the strings is designed by a third party, so I have to format the file this way. Any ideas, other than editing it afterward with MS-DOS?

--Brian
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 5th Sep 2005 08:33 Edited at: 5th Sep 2005 08:35
Bmad6,

I suppose that the string needing to be output onto a single line, could be made into three seperate strings. Then, all three strings could be written to a single line, by concentating them together within the write string command.



I have not experimented this idea. It's just a hypothesis.



+NanoBrain+
P Schnell
20
Years of Service
User Offline
Joined: 13th Feb 2005
Location:
Posted: 5th Sep 2005 11:10 Edited at: 5th Sep 2005 11:11
I think that will be operated something like:

You could try breaking down the strings and writing byte-by-byte, I don't think it returns after a byte, but it might not be read correctly by your program.

master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 5th Sep 2005 21:08
Nanobrain
Did you say "Hippopotomis?" Sorry. I've been watching corny Science movies all day Friday at school and I feel like my brain is burning with corny dialog. The reason I asked that is because on this one corny one somebody said "Let's make a hypothesis" and the other girl said "Did you say 'Hippopotomis?".

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 6th Sep 2005 00:06 Edited at: 6th Sep 2005 00:07
You could also use a string array where each element of the array can be up to 255 characters long.

Something along the lines of:



This writes 748 bytes and two carriage returns from a string array to a file, then reads them back in and displays them.

The string data is in a string array, but written out using Write Byte because Write String will add a CR/LF automatically after each write operation - something we don't want.

Write Byte doesn't do this, so the file DataFile.dat is always 450 bytes long.

TDK_Man

Bmad6
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: Virginia, United States
Posted: 6th Sep 2005 03:34
P Schnell and NanoBrain:
This doesn't work because it tries to concatenate the strings before it outputs them, and Dark Basic can only handle strings of up to 255 characters in length. Thanx for trying to help, though.

TDK:
I will try that, but the problem is, I have to output the string in standard ASCII encoding (that's how strings are encoded) because the program that reads the data is designed by someone else and it's already in use. do you know if the ASC() function encodes the data in standard ASCII? I will experiment to find out.

Thanx a ton, all of you.

--Brian
Bmad6
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: Virginia, United States
Posted: 6th Sep 2005 04:13
Sorry to double-post, but my other post hasn't shown up yet and I've got to go in a couple of minutes.

Anyways:

TDK, nevermind, I tested your method, and it works. I guess ASC stands for ASCII. Thanx a TON for your help, I really appreciate it.

--Brian
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 6th Sep 2005 05:11
master programmer,

Wow, that is corny...hehe.



+NanoBrain+

Login to post a reply

Server time is: 2025-05-22 08:50:56
Your offset time is: 2025-05-22 08:50:56