| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Declaring variables a |
"Stefanie" wrote in message
news:157fd$41b32ced$513b4d44$1464{at}news1.zonnet.nl...
| Hi,
|
| I have a question about declaring variables for writing data to a file
for
| random access.
| I have two string variables declared in a module (user-defined types).
| The point is that for one of them i can't define (hard coded) a fixed
| length because the application is reading data
| from another file (In that file they have the same lenght).
| Is it possible to use the lenght i obtain from reading that other file
to
| declare my variable or are there
| other possibilities.
|
| Thanks in advance,
|
| Stefanie
|
I think what you are after is how to write a string to an output file
with a specified field width, without using a fixed length string, since
you don't know the fixed length needed until run time.
If so, then you should be able to do something like this:
n = FixedLengthNeeded
j = Len(StringToWrite)
k = n - j ' spaces needed
If k > 0 Then
' print string and pad with spaces
Print #FileNum, StringToWrite, Space$(k)
Else
' clip string to maximum length
Print #FileNum, Left$(StringToWrite, n)
End If
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com
---
* RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
* RgateImp.MoonDog.BBS at 12/5/04 4:53:00 PM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)SEEN-BY: 633/267 270 5030/786 @PATH: 278/230 10/345 106/1 2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.