Assume that the first line of a file is read with:
InputLine = LineInput(FileN um)
I believe a file can be rewound as follows:
(So that the first line can be reread)
FileClose(FileN um) 'Rewind
FileOpen(FileNu m, mDataInFullPath , OpenMode.Input)
InputLine = LineInput(FileN um)
Isn't there a better way?
Thanks 4 7694
" **Developer**" <RE************ *@a-znet.com> wrote in message
news:OE******** ******@TK2MSFTN GP14.phx.gbl... Assume that the first line of a file is read with:
InputLine = LineInput(FileN um)
Looks like the Seek method is still supported so..... no need to close, just
use Seek.
Seek(FileNum, 1)
I'd provide the sample code the VB6 migration wizard provided but.... VSNet
crashed and burned when I hit F1 (or, maybe 90 seconds isn't enough to open
help anymore <sigh>) to look up help on the Seek method so.....
fwiw, I've written VB6 apps that use Seek to mark (and store) the beginning
of each line as they're read so I can return to any line in the file at
will. Surely, there's similar support in .Net (if you can keep it running
anyway ;-)
--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
I wasn't sure if Seek worked with LineInput.
Thanks
"Ken Halter" <Ken_Halter@Use _Sparingly_Hotm ail.com> wrote in message
news:ui******** ******@TK2MSFTN GP14.phx.gbl... " **Developer**" <RE************ *@a-znet.com> wrote in message news:OE******* *******@TK2MSFT NGP14.phx.gbl.. . Assume that the first line of a file is read with:
InputLine = LineInput(FileN um)
Looks like the Seek method is still supported so..... no need to close, just use Seek.
Seek(FileNum, 1)
I'd provide the sample code the VB6 migration wizard provided but.... VSNet crashed and burned when I hit F1 (or, maybe 90 seconds isn't enough to open help anymore <sigh>) to look up help on the Seek method so.....
fwiw, I've written VB6 apps that use Seek to mark (and store) the beginning of each line as they're read so I can return to any line in the file at will. Surely, there's similar support in .Net (if you can keep it running anyway ;-)
-- Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com Please keep all discussions in the groups..
Ken Halter wrote: " **Developer**" <RE************ *@a-znet.com> wrote in message news:OE******* *******@TK2MSFT NGP14.phx.gbl.. .
Assume that the first line of a file is read with:
InputLine = LineInput(FileN um)
Looks like the Seek method is still supported so..... no need to close, just use Seek.
Seek(FileNum , 1)
I'd provide the sample code the VB6 migration wizard provided but.... VSNet crashed and burned when I hit F1 (or, maybe 90 seconds isn't enough to open help anymore <sigh>) to look up help on the Seek method so.....
fwiw, I've written VB6 apps that use Seek to mark (and store) the beginning of each line as they're read so I can return to any line in the file at will. Surely, there's similar support in .Net (if you can keep it running anyway ;-)
Yes, seek(FileNum,1) is the way, and seek(FileNum) still returns the
current position. This is regardless of the method used to read the file.
Tom
thanks.
I noticed you send HTML. I was under the impression that many do not like
to receive HTML.
I like HTML but avoid it because it may be inconvenient for some.
Is that an obsolete notion?
"tomb" <to**@technetce nter.com> wrote in message
news:sc******** **********@bign ews1.bellsouth. net...
Ken Halter wrote:
" **Developer**" <RE************ *@a-znet.com> wrote in message
news:OE******** ******@TK2MSFTN GP14.phx.gbl...
Assume that the first line of a file is read with:
InputLine = LineInput(FileN um)
Looks like the Seek method is still supported so..... no need to close, just
use Seek.
Seek(FileNum, 1)
I'd provide the sample code the VB6 migration wizard provided but.... VSNet
crashed and burned when I hit F1 (or, maybe 90 seconds isn't enough to open
help anymore <sigh>) to look up help on the Seek method so.....
fwiw, I've written VB6 apps that use Seek to mark (and store) the beginning
of each line as they're read so I can return to any line in the file at
will. Surely, there's similar support in .Net (if you can keep it running
anyway ;-)
Yes, seek(FileNum,1) is the way, and seek(FileNum) still returns the current
position. This is regardless of the method used to read the file.
Tom This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Oliver Knoll |
last post by:
According to my ANSI book, tmpfile() creates a file with wb+ mode
(that is just writing, right?). How would one reopen it for reading?
I got the following (which works):
FILE *tmpFile = tmpfile();
/* write into tmpFile */
...
|
by: Don Pasquale |
last post by:
The following function intends to delete "numberoflines" lines from a text
file, named "s" (string pointer) and pointed to by file pointer "fp", starting
from line "line".
Now, the function works an inteded, but I think that this is purely
coincidential.
I'm using a temp file to copy the contents of the text file, and then, copy
the last...
|
by: yezi |
last post by:
Hi, ALl:
The following code is to canculate 2 vector distance. Suppose the
vectore is stored in some txt file like
-1 0.34
0 0.045
1 0.98
1 0.01
|
by: poison.summer |
last post by:
Hello I need to write and read a parameter through a file to get
communication between two processes.
I know how to use fopen, fprintf. But I wonder how can I overwrite the
old files.
For instance, I need to write the value of A into a file. Another
process need to access the data of A.
Then the first process will overwrite the value of A.
...
|
by: Charles D Hixson |
last post by:
I was reading through old messages in the list and came up against an
idea that I thought might be of some value:
"Wouldn't it be a good idea if one could "rewind" an iterator?"
Not stated in precisely those terms, perhaps, but that's the way I read it.
I appreciate that one could use a sequence rather than an iterator, and
that I don't...
| |
by: Olaf \El Blanco\ |
last post by:
Where is exactly neccesary to put "rewind(stdin)"?
After a printf? Before a scanf?
I have a lot of problems with strings...
If somebody know any good document, please let me know where is...
Thank you.
|
by: Olivier |
last post by:
Dear all,
I thought the code
-----------------------------
pt_fichier_probleme = fopen(nom_fichier, "w");
if(pt_fichier_probleme == NULL){
message_warning_s
("Erreur l'ouverture du fichier\n%s\n", (gchar *)nom_fichier);
return;}
|
by: Morris Neuman |
last post by:
Im working with VS 2005 and trying to use a Hyperlink field in a datagrid to
play a wave file that is not located in the website folders but is in a plain
folder on the same machine, windows 2003 server, WMP 10.0 .
If I type the full path in an IE address field it plays the file in WMP
When I test my Web page ( running the debugger in VS.)...
|
by: gp |
last post by:
i am implementing Iterator in a class, I have pretty much copied the
code from php.net on Object Iteration. Adding all the normal methods
for the task...rewind, current, next, etc.
I was attempting to add a seek method but am stymied by the above
warnin, as well getting a seek on index 0 (zero) to work.
public function...
|
by: Bill |
last post by:
Hello,
I'm trying to output buffer content to a file. I either get an access
violation error, or crazy looking output in the file depending on
which method I use to write the file. Can anyone help out a newbie?
#include <stdio.h>
#include <ctype.h>
#include <string.h>
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |