By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,640 Members | 1,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,640 IT Pros & Developers. It's quick & easy.

Reading of file gets cut off near the end.

P: n/a
Rvo
Hi all,

I have a routine that reads a binary file into a string, this worked fine
all the time, untill recently. Now the reading of the file seems to reach
the end of file too soon. At the end the file is cut off.

I have no clue what is going wrong here.

Below is the code snippet which I use to read the data. I had to make alle
lines comment because our firewall is kinda paranoid.

Thanks for your time.

Romain.

'toRead = FreeFile()

'binFile = ""

'ChDir(PathToUse)

'Microsoft.VisualBasic.FileOpen(toRead, myFilename, OpenMode.Binary,
OpenAccess.ReadWrite, OpenShare.LockReadWrite)

'While Not (EOF(teLezen))

' aLine = Microsoft.VisualBasic.FileSystem.LineInput(teLezen )

' binFile = binFile + aLine & vbCr

'End While

'Microsoft.VisualBasic.FileClose(toRead)


Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Rvo" <romainvoes@{DoesNotLikeSpam}vlaamsparlement.be> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have a routine that reads a binary file into a string, this worked fine
all the time, untill recently. Now the reading of the file seems to reach
the end of file too soon. At the end the file is cut off.
Search this file with a hex editor and see if you find ASCII character 26.
This is an end-of-file marker.

I highly recommend AGAINST using text-based functions like Line Input to
read binary data.
Below is the code snippet which I use to read the data. I had to make alle
lines comment because our firewall is kinda paranoid.


Your firewall understands Basic? Wow.
Nov 20 '05 #2

P: n/a
Rvo
Hi Jeff,

I didn't find any ascii value 26 in the file and the file is a just a long
text string.

When I put the last few lines together onto one longer line the file wil
read completely.
Regards,

Romain

PS: Our firewall is aware of possibly dangerous code (e.g. vbscript and the
likes). It's a pain :-)

"Jeff Johnson [MVP: VB]" <i.***@enough.spam> schreef in bericht
news:u3**************@TK2MSFTNGP11.phx.gbl...

"Rvo" <romainvoes@{DoesNotLikeSpam}vlaamsparlement.be> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have a routine that reads a binary file into a string, this worked fine all the time, untill recently. Now the reading of the file seems to reach the end of file too soon. At the end the file is cut off.


Search this file with a hex editor and see if you find ASCII character 26.
This is an end-of-file marker.

I highly recommend AGAINST using text-based functions like Line Input to
read binary data.
Below is the code snippet which I use to read the data. I had to make alle lines comment because our firewall is kinda paranoid.


Your firewall understands Basic? Wow.

Nov 20 '05 #3

P: n/a

"Rvo" <romainvoes@{DoesNotLikeSpam}vlaamsparlement.be> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
I didn't find any ascii value 26 in the file and the file is a just a long
text string.

When I put the last few lines together onto one longer line the file wil
read completely.


Why not go the .NET route and open a StreamReader against the file?
Nov 20 '05 #4

P: n/a
Rvo
Dear JEff,

I just did that and it works just fine. Thanks for your help.

Kind regards,

Romain

"Jeff Johnson [MVP: VB]" <i.***@enough.spam> schreef in bericht
news:O%****************@TK2MSFTNGP10.phx.gbl...

"Rvo" <romainvoes@{DoesNotLikeSpam}vlaamsparlement.be> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
I didn't find any ascii value 26 in the file and the file is a just a long text string.

When I put the last few lines together onto one longer line the file wil
read completely.


Why not go the .NET route and open a StreamReader against the file?

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.