Hi,
I have files I need to read, which contains records with a variable lenght.
What I need to do is Copy a Part of such a File to a new File, based on the
a Begin- and End-record.
I used this functions:
Dim intMyFile As Integer = FreeFile()
FileOpen(intMyFile, MakePathFile(strDirS, strFileS), OpenMode.Input,
OpenAccess.Read, OpenShare.Shared, -1)
Do While Not EOF(intMyFile)
strLine = LineInput(intMyFile)
If (intX >= intStartRec) And (intX <= intEndRec) Then
strNew = strNew & strLine & vbCrLf
End If
intX = intX + 1
Loop
It worked fine until I met some really big files. I have some files of 10
Mb, containing 75000 records... After 20 minutes my application still
doesn't have read the exact part.
I tryed this:
Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open,
FileAccess.Read)
Dim brFile As New StreamReader(fsFile,
System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1)
intX = 0
Do While intX <= intEndRec
strLine = brFile.ReadLine
If (intX >= intStartRec) And (intX <= intEndRec) Then
strNew = strNew & strLine & vbCrLf
End If
intX = intX + 1
Loop
But it's as slow as the other one.
Only one thing was really quick (only 10 seconds):
Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS),
FileMode.Open, FileAccess.Read)
Dim brFile As New StreamReader(fsFile,
System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1)
Dim strChar((intEndRec * 128) - 1) As Char
For intX = 0 To strChar.Length - 1
strChar(intX) = " "
Next
brFile.ReadBlock(strChar, intStartRec * 128, (intEndRec - intStartRec) *
128)
But here I had several stupid problems for which I din't really find a
solution:
- first of all: I'm having really big problems converting the Char to a
String (I tryed filing the Char with spaces and than Trim it but what about
spaces in the end of my File?)
- the ReadBlock works with character-positioning, and not with lines. Is
there a way to convert a line-position to a character-position or do a
ReadBlock with lines or something like that?
Anyhelp would really be appreciated!! I'm really stuck with this problem,
and it's kidn of urgent!! Any help regarding the ReadBlock or
StremReader-stuff, or on other (FAST!) way to do this would really be
appreciated!!
Thanks a lot in advance!!
Pieter 6 1723
you know better than this pieter.
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl... Hi,
I have files I need to read, which contains records with a variable
lenght. What I need to do is Copy a Part of such a File to a new File, based on
the a Begin- and End-record.
I used this functions: Dim intMyFile As Integer = FreeFile() FileOpen(intMyFile, MakePathFile(strDirS, strFileS),
OpenMode.Input, OpenAccess.Read, OpenShare.Shared, -1) Do While Not EOF(intMyFile) strLine = LineInput(intMyFile) If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
It worked fine until I met some really big files. I have some files of 10 Mb, containing 75000 records... After 20 minutes my application still doesn't have read the exact part.
I tryed this: Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS),
FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) intX = 0 Do While intX <= intEndRec strLine = brFile.ReadLine If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
But it's as slow as the other one. Only one thing was really quick (only 10 seconds): Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) Dim strChar((intEndRec * 128) - 1) As Char For intX = 0 To strChar.Length - 1 strChar(intX) = " " Next brFile.ReadBlock(strChar, intStartRec * 128, (intEndRec - intStartRec) * 128)
But here I had several stupid problems for which I din't really find a solution: - first of all: I'm having really big problems converting the Char to a String (I tryed filing the Char with spaces and than Trim it but what
about spaces in the end of my File?) - the ReadBlock works with character-positioning, and not with lines. Is there a way to convert a line-position to a character-position or do a ReadBlock with lines or something like that?
Anyhelp would really be appreciated!! I'm really stuck with this problem, and it's kidn of urgent!! Any help regarding the ReadBlock or StremReader-stuff, or on other (FAST!) way to do this would really be appreciated!!
Thanks a lot in advance!!
Pieter
you know better than this pieter.
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl... Hi,
I have files I need to read, which contains records with a variable
lenght. What I need to do is Copy a Part of such a File to a new File, based on
the a Begin- and End-record.
I used this functions: Dim intMyFile As Integer = FreeFile() FileOpen(intMyFile, MakePathFile(strDirS, strFileS),
OpenMode.Input, OpenAccess.Read, OpenShare.Shared, -1) Do While Not EOF(intMyFile) strLine = LineInput(intMyFile) If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
It worked fine until I met some really big files. I have some files of 10 Mb, containing 75000 records... After 20 minutes my application still doesn't have read the exact part.
I tryed this: Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS),
FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) intX = 0 Do While intX <= intEndRec strLine = brFile.ReadLine If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
But it's as slow as the other one. Only one thing was really quick (only 10 seconds): Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) Dim strChar((intEndRec * 128) - 1) As Char For intX = 0 To strChar.Length - 1 strChar(intX) = " " Next brFile.ReadBlock(strChar, intStartRec * 128, (intEndRec - intStartRec) * 128)
But here I had several stupid problems for which I din't really find a solution: - first of all: I'm having really big problems converting the Char to a String (I tryed filing the Char with spaces and than Trim it but what
about spaces in the end of my File?) - the ReadBlock works with character-positioning, and not with lines. Is there a way to convert a line-position to a character-position or do a ReadBlock with lines or something like that?
Anyhelp would really be appreciated!! I'm really stuck with this problem, and it's kidn of urgent!! Any help regarding the ReadBlock or StremReader-stuff, or on other (FAST!) way to do this would really be appreciated!!
Thanks a lot in advance!!
Pieter
Hihihi damn I'm affraid I don't dare to come back to this newsgroups, hihi
:-) I really made some stupid mistake :-/
That's what happens when you make love to your girlfriend during the
lunch-break, come too late back at work and skip accidently a meeting... No
wonder I didn't think clear, hahahaha :-)
Thanks guys!
And my apologizes for the 2 postings, but my Outlook Express deleted the
first message, and 30 minutes later it suddenly came back :-/
Pieter
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com... you know better than this pieter.
"DraguVaso" <pi**********@hotmail.com> wrote in message news:%2******************@TK2MSFTNGP10.phx.gbl... Hi,
I have files I need to read, which contains records with a variable lenght. What I need to do is Copy a Part of such a File to a new File, based on the a Begin- and End-record.
I used this functions: Dim intMyFile As Integer = FreeFile() FileOpen(intMyFile, MakePathFile(strDirS, strFileS), OpenMode.Input, OpenAccess.Read, OpenShare.Shared, -1) Do While Not EOF(intMyFile) strLine = LineInput(intMyFile) If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
It worked fine until I met some really big files. I have some files of
10 Mb, containing 75000 records... After 20 minutes my application still doesn't have read the exact part.
I tryed this: Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) intX = 0 Do While intX <= intEndRec strLine = brFile.ReadLine If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
But it's as slow as the other one. Only one thing was really quick (only 10 seconds): Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) Dim strChar((intEndRec * 128) - 1) As Char For intX = 0 To strChar.Length - 1 strChar(intX) = " " Next brFile.ReadBlock(strChar, intStartRec * 128, (intEndRec - intStartRec)
* 128)
But here I had several stupid problems for which I din't really find a solution: - first of all: I'm having really big problems converting the Char to a String (I tryed filing the Char with spaces and than Trim it but what about spaces in the end of my File?) - the ReadBlock works with character-positioning, and not with lines. Is there a way to convert a line-position to a character-position or do a ReadBlock with lines or something like that?
Anyhelp would really be appreciated!! I'm really stuck with this
problem, and it's kidn of urgent!! Any help regarding the ReadBlock or StremReader-stuff, or on other (FAST!) way to do this would really be appreciated!!
Thanks a lot in advance!!
Pieter
Hihihi damn I'm affraid I don't dare to come back to this newsgroups, hihi
:-) I really made some stupid mistake :-/
That's what happens when you make love to your girlfriend during the
lunch-break, come too late back at work and skip accidently a meeting... No
wonder I didn't think clear, hahahaha :-)
Thanks guys!
And my apologizes for the 2 postings, but my Outlook Express deleted the
first message, and 30 minutes later it suddenly came back :-/
Pieter
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com... you know better than this pieter.
"DraguVaso" <pi**********@hotmail.com> wrote in message news:%2******************@TK2MSFTNGP10.phx.gbl... Hi,
I have files I need to read, which contains records with a variable lenght. What I need to do is Copy a Part of such a File to a new File, based on the a Begin- and End-record.
I used this functions: Dim intMyFile As Integer = FreeFile() FileOpen(intMyFile, MakePathFile(strDirS, strFileS), OpenMode.Input, OpenAccess.Read, OpenShare.Shared, -1) Do While Not EOF(intMyFile) strLine = LineInput(intMyFile) If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
It worked fine until I met some really big files. I have some files of
10 Mb, containing 75000 records... After 20 minutes my application still doesn't have read the exact part.
I tryed this: Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) intX = 0 Do While intX <= intEndRec strLine = brFile.ReadLine If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
But it's as slow as the other one. Only one thing was really quick (only 10 seconds): Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) Dim strChar((intEndRec * 128) - 1) As Char For intX = 0 To strChar.Length - 1 strChar(intX) = " " Next brFile.ReadBlock(strChar, intStartRec * 128, (intEndRec - intStartRec)
* 128)
But here I had several stupid problems for which I din't really find a solution: - first of all: I'm having really big problems converting the Char to a String (I tryed filing the Char with spaces and than Trim it but what about spaces in the end of my File?) - the ReadBlock works with character-positioning, and not with lines. Is there a way to convert a line-position to a character-position or do a ReadBlock with lines or something like that?
Anyhelp would really be appreciated!! I'm really stuck with this
problem, and it's kidn of urgent!! Any help regarding the ReadBlock or StremReader-stuff, or on other (FAST!) way to do this would really be appreciated!!
Thanks a lot in advance!!
Pieter
Wow.
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:Ow***************@tk2msftngp13.phx.gbl... Hihihi damn I'm affraid I don't dare to come back to this newsgroups, hihi :-) I really made some stupid mistake :-/
That's what happens when you make love to your girlfriend during the lunch-break, come too late back at work and skip accidently a meeting...
No wonder I didn't think clear, hahahaha :-)
Thanks guys!
And my apologizes for the 2 postings, but my Outlook Express deleted the first message, and 30 minutes later it suddenly came back :-/
Pieter
"CJ Taylor" <no****@blowgoats.com> wrote in message news:10*************@corp.supernews.com... you know better than this pieter.
"DraguVaso" <pi**********@hotmail.com> wrote in message news:%2******************@TK2MSFTNGP10.phx.gbl... Hi,
I have files I need to read, which contains records with a variable lenght. What I need to do is Copy a Part of such a File to a new File, based
on the a Begin- and End-record.
I used this functions: Dim intMyFile As Integer = FreeFile() FileOpen(intMyFile, MakePathFile(strDirS, strFileS), OpenMode.Input, OpenAccess.Read, OpenShare.Shared, -1) Do While Not EOF(intMyFile) strLine = LineInput(intMyFile) If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
It worked fine until I met some really big files. I have some files of 10 Mb, containing 75000 records... After 20 minutes my application still doesn't have read the exact part.
I tryed this: Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) intX = 0 Do While intX <= intEndRec strLine = brFile.ReadLine If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
But it's as slow as the other one. Only one thing was really quick (only 10 seconds): Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) Dim strChar((intEndRec * 128) - 1) As Char For intX = 0 To strChar.Length - 1 strChar(intX) = " " Next brFile.ReadBlock(strChar, intStartRec * 128, (intEndRec -
intStartRec) * 128)
But here I had several stupid problems for which I din't really find a solution: - first of all: I'm having really big problems converting the Char to
a String (I tryed filing the Char with spaces and than Trim it but what
about spaces in the end of my File?) - the ReadBlock works with character-positioning, and not with lines.
Is there a way to convert a line-position to a character-position or do a ReadBlock with lines or something like that?
Anyhelp would really be appreciated!! I'm really stuck with this problem, and it's kidn of urgent!! Any help regarding the ReadBlock or StremReader-stuff, or on other (FAST!) way to do this would really be appreciated!!
Thanks a lot in advance!!
Pieter
Wow.
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:Ow***************@tk2msftngp13.phx.gbl... Hihihi damn I'm affraid I don't dare to come back to this newsgroups, hihi :-) I really made some stupid mistake :-/
That's what happens when you make love to your girlfriend during the lunch-break, come too late back at work and skip accidently a meeting...
No wonder I didn't think clear, hahahaha :-)
Thanks guys!
And my apologizes for the 2 postings, but my Outlook Express deleted the first message, and 30 minutes later it suddenly came back :-/
Pieter
"CJ Taylor" <no****@blowgoats.com> wrote in message news:10*************@corp.supernews.com... you know better than this pieter.
"DraguVaso" <pi**********@hotmail.com> wrote in message news:%2******************@TK2MSFTNGP10.phx.gbl... Hi,
I have files I need to read, which contains records with a variable lenght. What I need to do is Copy a Part of such a File to a new File, based
on the a Begin- and End-record.
I used this functions: Dim intMyFile As Integer = FreeFile() FileOpen(intMyFile, MakePathFile(strDirS, strFileS), OpenMode.Input, OpenAccess.Read, OpenShare.Shared, -1) Do While Not EOF(intMyFile) strLine = LineInput(intMyFile) If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
It worked fine until I met some really big files. I have some files of 10 Mb, containing 75000 records... After 20 minutes my application still doesn't have read the exact part.
I tryed this: Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) intX = 0 Do While intX <= intEndRec strLine = brFile.ReadLine If (intX >= intStartRec) And (intX <= intEndRec) Then strNew = strNew & strLine & vbCrLf End If intX = intX + 1 Loop
But it's as slow as the other one. Only one thing was really quick (only 10 seconds): Dim fsFile As New FileStream(MakePathFile(strDirS, strFileS), FileMode.Open, FileAccess.Read) Dim brFile As New StreamReader(fsFile, System.Text.Encoding.GetEncoding(1252), False, fsFile.Length - 1) Dim strChar((intEndRec * 128) - 1) As Char For intX = 0 To strChar.Length - 1 strChar(intX) = " " Next brFile.ReadBlock(strChar, intStartRec * 128, (intEndRec -
intStartRec) * 128)
But here I had several stupid problems for which I din't really find a solution: - first of all: I'm having really big problems converting the Char to
a String (I tryed filing the Char with spaces and than Trim it but what
about spaces in the end of my File?) - the ReadBlock works with character-positioning, and not with lines.
Is there a way to convert a line-position to a character-position or do a ReadBlock with lines or something like that?
Anyhelp would really be appreciated!! I'm really stuck with this problem, and it's kidn of urgent!! Any help regarding the ReadBlock or StremReader-stuff, or on other (FAST!) way to do this would really be appreciated!!
Thanks a lot in advance!!
Pieter
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: GS |
last post by:
The stdint.h header definition mentions five integer categories,
1) exact width, eg., int32_t
2) at least as wide as, eg., int_least32_t
3) as fast as possible but at least as wide as, eg.,...
|
by: Cable |
last post by:
Hello,
I am hoping that someone can answer a question or two regarding file
access. I have created an app that reads an image from a file then
displays it (using OpenGL). It works well using...
|
by: DraguVaso |
last post by:
Hi,
I have files I need to read, which contains records with a variable lenght.
What I need to do is Copy a Part of such a File to a new File, based on the
a Begin- and End-record.
I used...
|
by: DraguVaso |
last post by:
Hi,
I have files I need to read, which contains records with a variable lenght.
What I need to do is Copy a Part of such a File to a new File, based on the
a Begin- and End-record.
I used...
|
by: Együd Csaba |
last post by:
> -----Original Message-----
> From: pgsql-admin-owner@postgresql.org
> On Behalf Of Együd Csaba
> Sent: 2004. július 16. 12:23
> To: pgsql-admin (E-mail)
> Subject: URGENT - Postgres won't...
| |
by: ginnisharma1 |
last post by:
Hi All,
I am very new to C language and I got really big assignment in my
work.I am wondering if anyone can help me.........I need to port
compiler from unix to windows and compiler is written...
|
by: devil123 |
last post by:
hey .. i am a beginner in visual basic ... i want a urgent help
i have created a application which is having 2 text files as input ..now i have to do something like "click a button to browse...
|
by: Umesh |
last post by:
CoffeeVendor is a program, which simulate a coffee machine. The coffee
machine serves coffee with sugar and creamer for Rs.10/- and Rs.6/-
without sugar and creamer (black coffee). The coffee...
|
by: Salad |
last post by:
I have access, for testing at my client's site, a Win2000 computer
running A2003 retail. He recently upgraded all of his other machines to
DualCore Pentiums with 2 gig ram and run A2003 runtime. ...
|
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,...
|
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...
| |
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...
|
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: 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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |