Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: FSO ARRGGG!!!


Message #1 by "Daniel O'Dorisio" <daniel@o...> on Thu, 27 Sep 2001 00:12:41 -0400
Thanks.
That is a possible problem. I was thinking of till I realized how
caffenne deprived I was. I was doing it totally wrong. I put a .readall
and then was trying to do .readline (the readall was a different
approach I was taking at first, I forgot to remove that line) and then I
was using skip rather then skip line. Many many problems. But I think
there still will be a problem with the unix anc windows carriage
returns. So I will definitely reference your email when I test it (just
got out of school, so I gotta cut grass but I hope to get on it tonight)

Btw. Is the FSO the best way to interact with files and folders on
windows systems with vb? I am developing a plan to present to the
management for a backup document management system (some documents are
not being saved to the server due to problems with who knows what.. It
is a beta system) and my plan is to save all the docs to a folder that
is on a NAS device. And then use FSO to update a catalog file and read
from it, (either that or use a RDBMS to store the catalog)

Thanks
daniel

-----Original Message-----
From: Kim, Cardyin [mailto:CKim@s...] 
Sent: Thursday, September 27, 2001 11:47 AM
To: professional vb
Subject: [pro_vb] RE: FSO ARRGGG!!!


Dan,

   There is a difference between how end of line is denoted between Unix
and PC systems.  I suspect you are running into your problem because
your program is trying to read one line of data, but it is confused on
exactly where end of line happens to be.

   We've had a similiar problem here.  The solution we
used was some old C++ code that someone wrote way back
to convert the file from Unix to PC file type.  Luckily
I had VC++ so I just copied the code and compiled our
own exe utiliy.  Since then, I have found a web page on
the internet that has the compiled version of the
program with a few added functions.  The file is
called flip.exe

During the program I simply use the scripting shell
function to run the following line of code:

h:\flip.exe -mb c:\era.dat

This changes era.dat to a PC format.  Then I simply
used the Open, Line Input #, and Print # statements
to get the information I need.

If you are intersted in this solution and can't find
the link on the internet through a search engine,
let me know.  I'll poke around and see if I can
find the link for you.

Cardyin

---------------------------------------
Cardyin Kim
Client/Server & Web Development Analyst
---------------------------------------


-----Original Message-----
From: Daniel O'Dorisio [mailto:daniel@o...]
Sent: Wednesday, September 26, 2001 9:12 PM
To: professional vb
Subject: [pro_vb] FSO ARRGGG!!!


Hey, 
Maybe I just need some more cola, but here is the problem. What am I not
seeing?

I am trying to use FSO to iterate through a file that is pulled off a
unix server. the code is:

Dim lvitem As Object
  Dim objFso As FileSystemObject
  Dim objtmpfile As Object
  Dim finished As Boolean
  Dim strcontents As String
  Dim strArrcontents() As String
  Dim i As Integer
  
  
  i = 0
  Set objFso = New FileSystemObject
  Set objtmpfile = objFso.OpenTextFile("c:\tmpfile.lst", ForReading)
  strcontents = objtmpfile.ReadAll
  Do Until finished = True
    objtmpfile.Skip (i)
    
    strcontents = objtmpfile.ReadLine
    If strcontents = "" Then
        finished = True
    Else
    strArrcontents() = Split(strcontents, " ")
    Set lvitem = lvDocs.ListItems.Add(, , strArrcontents(0))
    lvitem.SubItems(1) = strArrcontents(2)
    lvitem.SubItems(2) = strArrcontents(1)
    End If
  i = i + 1
  Loop

And for some reason I get a runtime error 62, input past end of file.
What could be causing this?

Could it be a file translation problem with the file that is coming from
the unix server? I thought maybe it was caused by that, so I went and
created my own file and typed in some sample data.. To no luck. 

Thanks

daniel
---
You are currently subscribed to pro_vb as: dodorisio@h... To
unsubscribe send a blank email to $subst('Email.Unsub')


  Return to Index