Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > File I/O and Registry > how do you move the current file position


Reply
 
Thread Tools Display Modes
  #1  
Old 08-06-2003, 04:40 AM
dwall dwall is offline
Junior Contributor
 
Join Date: Aug 2003
Location: England
Posts: 377
Unhappy how do you move the current file position


I have a text file which Ineed to read one character at a time, which isn't a problem but on occassion I need to step back to the previous character and read it again. In C I use the seek() function but in vb this doesn't allow negative numbers. can anyone help?
__________________
Its the little things you never knew you did't know until you know them that make the difference
Reply With Quote
  #2  
Old 08-06-2003, 05:46 AM
ocmeng ocmeng is offline
Centurion
 
Join Date: Jul 2003
Posts: 157
Default

Read every character in your file into array. Then read element by element and keep track of ur current position by a counter. When u need to repeat the previous character under certain condition, just refer to it using the counter. Does it solve ur problem ? or I misunderstood your problem?
Reply With Quote
  #3  
Old 08-06-2003, 06:50 AM
dwall dwall is offline
Junior Contributor
 
Join Date: Aug 2003
Location: England
Posts: 377
Default

Quote:
Originally Posted by ocmeng
Read every character in your file into array. Then read element by element and keep track of ur current position by a counter. When u need to repeat the previous character under certain condition, just refer to it using the counter. Does it solve ur problem ? or I misunderstood your problem?




This would solve the problem although i'm not sure how it would like to deal with a 12meg txt file, I had thought of something like this and also keeping a variable with the previous character in, i just thought there might be a slicker way of moving within the file. Thanks anyway
Reply With Quote
  #4  
Old 08-06-2003, 07:05 AM
Thinker Thinker is offline
Iron-Fisted Programmer

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
Default

There is a seek function in VB and if you use the Get command to read
the next byte you can specify the byte position as the second parameter.
__________________
Posting Guidelines
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Installation Problem - PLs help urgenlty dpdsouza Installation / Documentation 4 12-02-2004 07:09 PM
Doesn't want to register! MikeyM Installation / Documentation 5 03-02-2003 08:22 PM
making music continue GrimViper General 3 05-01-2001 10:40 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->