473,396 Members | 1,760 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.

read text file with stange format

I have a text file that is formatted like this:

123456789 SOLD 1
12/12/2006 Smith 45,525
987654321 SOLD 3
01/01/2006 Jones 23,252
I need to read this file and parse the data and then load it into the
database. I can get the values for line one but how can I get the values for
the next line? I'm using the substring() method to get my data but when I
try and get the second line its returning me the data for the first line
Jun 15 '06 #1
3 1211
It sounds like a simple mistake in the code, like reading from the wrong
string variable, or something.

What does the code look like?
John wrote:
I have a text file that is formatted like this:

123456789 SOLD 1
12/12/2006 Smith 45,525
987654321 SOLD 3
01/01/2006 Jones 23,252
I need to read this file and parse the data and then load it into the
database. I can get the values for line one but how can I get the values for
the next line? I'm using the substring() method to get my data but when I
try and get the second line its returning me the data for the first line

Jun 15 '06 #2
the code is just reading the file line by line and getting the string value
using string.substring() method
the code works with all of the other files it reads and uploads, I just have
a newly formatted file that needs to be read
"Göran Andersson" <gu***@guffa.com> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
It sounds like a simple mistake in the code, like reading from the wrong
string variable, or something.

What does the code look like?
John wrote:
I have a text file that is formatted like this:

123456789 SOLD 1
12/12/2006 Smith 45,525
987654321 SOLD 3
01/01/2006 Jones 23,252
I need to read this file and parse the data and then load it into the
database. I can get the values for line one but how can I get the values
for the next line? I'm using the substring() method to get my data but
when I try and get the second line its returning me the data for the
first line

Jun 15 '06 #3
The substring method can't return characters from any other string than
the one used to call the method.

John wrote:
the code is just reading the file line by line and getting the string value
using string.substring() method
the code works with all of the other files it reads and uploads, I just have
a newly formatted file that needs to be read
"Göran Andersson" <gu***@guffa.com> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
It sounds like a simple mistake in the code, like reading from the wrong
string variable, or something.

What does the code look like?
John wrote:
I have a text file that is formatted like this:

123456789 SOLD 1
12/12/2006 Smith 45,525
987654321 SOLD 3
01/01/2006 Jones 23,252
I need to read this file and parse the data and then load it into the
database. I can get the values for line one but how can I get the values
for the next line? I'm using the substring() method to get my data but
when I try and get the second line its returning me the data for the
first line


Jun 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ron | last post by:
I have a text file with the following format (pipe delimited) |column1=value|column2=value|column3=value|column4=value|... |column1=value|column2=value|column3=value|column4=value|... I have...
10
by: QQ | last post by:
I am trying to read data from Excel files I use the following codes, however, it didn't work Can anyone tell me what the format excel files have, what I should do to read it from C? Thanks a...
14
by: Mark Broadbent | last post by:
Does anybody know what is (factual please -not just guess) the quickest method to read data from a file? I am not interested in the format of the data (i.e. blocks, bytes, string etc) just that the...
7
by: Hallvard B Furuseth | last post by:
I'm trying to clean up a program which does arithmetic on text file positions, and also reads text files in binary mode. I can't easily get rid of it all, so I'm wondering which of the following...
9
by: srikanth | last post by:
i have a text file like below, test.txt file (actually my test file file is with 10000 lines but here i tested with 3 lines) 3 06.09.2006 16:37:25 3 06.09.2006 16:40:02 3 06.09.2006 16:42:31...
3
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
I try to follow Steve's paper to build a database, and store a small text file into SQL Server database and retrieve it later. Only difference between my table and Steve's table is that I use NTEXT...
9
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
I want to open a text file and format it into a specific line and then apply color to a specific location of the text and then display it in a RichTextBox after all of this is done. I can do all...
6
by: zl2k | last post by:
hi, there I have a appendable binary file of complex data structure named data.bin created by myself. It is written in the following format: number of Data, Data array Suppose I have...
4
by: Keith G Hicks | last post by:
I'm trying to read a text file and alter the contents of specific lines in the file. I know how to use streamreader to read each line of a file. I'm doing that already to get the data into a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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.