Thanks Tom and Joe for your replies.
Just checking the last bit of the existing file would be preferable
to reading the entire file. This is eventually going to be a list of
registration info for demo users of my application. At the moment its
just a few lines for testing, but it will accumulate to a fairly
large file.
If you exercise total control ofver the origbinal files creation
though, your best bet is to make sure it goes out with an EndOfLine
character appended to it.
I don't have any problem when the file is only being manipulated by
my own realbasic code. Right now, I have a small application that
looks through email on my machine, collects the relevant emails,
parses out form submission data from them and then write these as
lines of tab separated text appended to the existing file.
The problem begins when the resulting file is opened and edited in
Excel. The text file opens as a spreadsheet as expected, each line of
text as a row on the sheet. Inserting/deleting rows or editing cell
contents seems to delete the endofline so that the next attempt to
append to the same file often extends the last line, instead of
starting a new one.
If I open the text file in Word, at least I can set it to show the
invisible characters, and see whether the line break has been deleted
or not. But I would rather avoid yet another step in the file
manipulation.
Is there possibly a more reliable file format for this type of record?
thanks
Rob
On Mar 11, 2006, at 12:44 AM, realbasic-nug-
[EMAIL PROTECTED] wrote:
From: Tom Benson <[EMAIL PROTECTED]>
Date: Sat, 11 Mar 2006 13:48:40 +1100
You could try
if right(textInputStream.Readall,1) = EndOfLine then
If you exercise total control ofver the origbinal files creation
though, your best bet is to make sure it goes out with an EndOfLine
character appended to it.
Cheers,
Tom
Subject: Re: tab delimited text & excel, RB 5.5.5
From: "Joseph J. Strout" <[EMAIL PROTECTED]>
Date: Fri, 10 Mar 2006 20:16:52 -0700
Better make that Right(TextInputStream.ReadAll, EndOfLine.Len)
instead; you shouldn't assume that EndOfLine is a single character.
And of course, it's a bit inefficient to read the whole file just to
check the last character or two. Better might be something like
(assuming tis is your TextInputStream, and f is the file it was
opened from):
tis.Position = f.Length - EndOfLine.Len
if tis.Read( EndOfLine.Line ) = EndOfLine then
Same idea, just skips some extra reading.
HTH,
- Joe
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>