473,396 Members | 1,982 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 .txt with records longer then 1025 characters

jeffstl
432 Expert 256MB
I have just been handed a project to determine a file format for a file upload of mass amounts of data.

I have done this exact program before but for records that were 864 characters in length in notepad.

The format I need to set up will far exceed the 1025 notepad limit length and therefore create a new line.

I could set up a loop that treats 2 or 3 lines as a single record, however I am envisioning all kinds of problems with this, especially if one record has more or less data then another I would have to write out spaces to push the full length for each record.

On another note though I notice that Notepad++ doesn't have the same limitations.

I would imagine though that VB 6.0 will read in a line from notepad as a 1025 character string period regardless of what I do ?

In other words is there anything that anyone is aware of that will have VB treat a .txt line read differently so that a single line read can go farther then the 1025 limit of notepad?
Mar 26 '08 #1
2 4375
kadghar
1,295 Expert 1GB
In other words is there anything that anyone is aware of that will have VB treat a .txt line read differently so that a single line read can go farther then the 1025 limit of notepad?
A string can be of any length, and what VB reads as next line is the 'next line' character.

So as long as you dont have Chr(13) <--- line change in your string, you'll only have one line.

So if you want to have a single-lined string in VB, just use the REPLACE function to get rid of Chr(13) (and Chr(10) too)

e.g.

lets say you read your txt file into a string (Str1), then just

Expand|Select|Wrap|Line Numbers
  1. str1 = replace(str1,chr(13),"")
  2. str1 = replace(str1,chr(10),"")
HTH
Mar 26 '08 #2
jeffstl
432 Expert 256MB
A string can be of any length, and what VB reads as next line is the 'next line' character.

So as long as you dont have Chr(13) <--- line change in your string, you'll only have one line.

So if you want to have a single-lined string in VB, just use the REPLACE function to get rid of Chr(13) (and Chr(10) too)

e.g.

lets say you read your txt file into a string (Str1), then just

Expand|Select|Wrap|Line Numbers
  1. str1 = replace(str1,chr(13),"")
  2. str1 = replace(str1,chr(10),"")
HTH
Ok. That is a good point. I will try that and see if it will ignore notepad limit of 1025 columns.

I will post when I get back on that project to update thread.
Apr 2 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Milo Woodward | last post by:
Does anyone know how to retrieve the number of records an XML file contains with a vb.net method? I can read through an entire XML file, import records into SQL Server, etc. However, I don't want...
7
by: jamait | last post by:
Hi all, I m trying to read in a text file into a datatable... Not sure on how to split up the information though, regex or substrings...? sample: Col1 Col2 ...
12
by: AMT2K5 | last post by:
Hello. I have a file (for a school assignment) with the following format and delimiter format. Each record in the file has the following format: 123423454567987,29873,James,Ha­rry,St....
6
by: AMT2K5 | last post by:
Hello. I have a file (for a school assignment) with the following format and delimiter format. Each record in the file has the following format: 123423454567987,29873,James,Harry,St....
40
by: googler | last post by:
I'm trying to read from an input text file and print it out. I can do this by reading each character, but I want to implement it in a more efficient way. So I thought my program should read one...
9
by: haibhoang | last post by:
I have a Windows Service that is trying to parse a large (> 1Gig) text file. I am keep getting OutOfMemoryException exception. Here is the code that's having problem: using (StreamReader...
10
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that...
26
by: vlsidesign | last post by:
I am a newbie and going through "The C programming language" by Kernighan & Richie on my own time (I'm not a programmer but I want to learn because it can save me time in my normal job, and it is...
6
by: efrenba | last post by:
Hi, I came from delphi world and now I'm doing my first steps in C++. I'm using C++builder because its ide is like delphi although I'm trying to avoid the vcl. I need to insert new features...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.