473,396 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reading of file gets cut off near the end.

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
4 1753

"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
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

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steven Burn | last post by:
The application; Service on my webserver that allows a user to upload their HOSTS file for functions to verify the contents are still valid. Uses; 1. XMLHTTP (MSXML2) 2. FileSystemObject...
3
by: SB | last post by:
Hello. I have an input file which is laid out in the following manner... Name Day 1 am time 1 am time 2 appointment pm time 1 pm time 2 appointment Day 2
3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
10
by: T Cordon | last post by:
I am using a StreamReader to read text from an HTML file and display it as part of a page in a Label Control. Buy it is not displaying characters as: ñ, ó, ú, etc. Please Help. Thanks
1
by: kierenj | last post by:
Hi, I'm trying to send a zipfile to a client using Content-Disposition: attachment. Done it before and it works fine. My code is below: context.Response.Buffer = false;...
9
by: Justin Rich | last post by:
looking for the best approach to reading a real time log file. The file gets updated pretty quickly, always appended to the end. do i really need to just keep re-opening the file and reading the...
5
by: Amy L. | last post by:
I am at an absolute loss on what is going on here. I have a text file with some Spanish writing. Some of the characters have accents. I have not found anyway to read this text file and echo the...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
41
by: biplab | last post by:
Hi all, I want to read the pixel values of a .bmp image(which will be input to the code) into a matrix...plz help me out as i can not understand how to achieve this... thanks in advance ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.