This may not be the solution you are looking for, but why not use the LOF
function and load the whole file into a string variable, use the SPLIT
function and split it into an array and go from there? Changing a string in
a variable is a lot easier, and a lot less headaches it would seem to me. 
 
Rick Rose
-------Original Message-------
 
From: HouseDad
Date: 02/09/05 09:51:54
To: [email protected]
Subject: [vbhelp] Text File Manipulation
 
 
 
 
Ok, I have a high-priority project I just started and need to
complete in a couple days.
 
Basically I am reading a text file with many records (lines) and
need to change data within that record/line on the fly.
 
I originally was going to access the file as RANDOM and take
advantage of PUT and GET flexibility, but the lines/records won't
always have the same length.
 
As I am writing this, I am thinking maybe it will work if I
define a type for each record. Whilst the line lengths won't be the
same, the position of the fields in the record should be consistent.
 
Basially, there are three individual RECORDS(lines) which make up
a form. I guess if I define a type for each of the three records, I
can access the file by using three GET statements for the three
types...
 
Wait a minute, maybe one type which includes the three records...
 
The problem is, how can I use PUT to change a specific record
when there are different record formats in the file?
 
Ok. Lets say I define a type which has all three lines in it,
which is ok, because really the three lines are in actuallity one
record in real life, so PUT would find the record ok that way I
guess, but there are CrLf's at the end of each line and those lines
may not be the same length for each new record (or set of three
lines). Argh!
 
I need to be able to change the data in a certain position. I
don't know how to do this using line inputs and string searches
without having to re-write the file every time a change is made, I
would like to be able to use some kind of RANDOM functionality here
to change the data, but don't know if it will work.
 
I guess if the line lengths are always the same for each type I
can read the CrLf as a separate field in the middle of the TYPE
declaration...
 
 
Basically, in a nutshell, here's what I am doing. I am reading a
text file which is not delimited except for CrLf at the end of each
line. I can identify a unique record number in the first line of
each set of three. I need to read a field and replace the data in
that field, which might need to be done on any of the three lines
which are not all the same format.
 
I am going to try defining all three lines with CrLf as a field
like I mentioned previously...
 
 
Will check back after I look into it some more.
 
Would really appreciate any feedback on this project.
 
Thanks in advance...
 
Chris
 
 
 
 
 
 
 
 
 
'// =======================================================
Rules : http://ReliableAnswers.com/List/Rules.asp
Home : http://groups.yahoo.com/group/vbHelp/
=======================================================
Post : [email protected]
Join : [EMAIL PROTECTED]
Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links
 
 
 
 
 
 
 
 




'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to