473,386 Members | 1,973 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,386 software developers and data experts.

How to wirte a char to a specified location in a txt file?

Hi,Everybody:
In EVB(or VB6), WriteFile() function starts writing data
to the file at the position indicated by the file pointer.
After the write operation has been completed, the file
pointer is adjusted by the number of bytes actually
written. But in VB.net which function can replace it? May
i use System.IO.FileStream.Seek locate the location and
then use System.IO.streamwriter to write char to txt file?

FS = New IO.FileStream(workDir & "\" & appInputFile,
IO.FileMode.Create, IO.FileAccess.Write)

sw = New IO.StreamWriter(FS)

FS.Seek((CurrentPoint - 1) *
FixedLen,IO.SeekOrigin.Current)

sw.Write(string)
Nov 20 '05 #1
1 1649
* <an*******@discussions.microsoft.com> scripsit:
In EVB(or VB6), WriteFile() function starts writing data
to the file at the position indicated by the file pointer.
After the write operation has been completed, the file
pointer is adjusted by the number of bytes actually
written. But in VB.net which function can replace it? May
i use System.IO.FileStream.Seek locate the location and
then use System.IO.streamwriter to write char to txt file?

FS = New IO.FileStream(workDir & "\" & appInputFile,
IO.FileMode.Create, IO.FileAccess.Write)

sw = New IO.StreamWriter(FS)

FS.Seek((CurrentPoint - 1) *
FixedLen,IO.SeekOrigin.Current)

sw.Write(string)


Why not test it on your own?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Improve your quoting style:
<http://learn.to/quote>
<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #2

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

Similar topics

3
by: Vishal Ladha | last post by:
Hi ! I have been experimenting with char * for a while now. I have two pieces of code : Code1 : ===== char *ptr = "hello";
11
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I've noticed a few threads (full of sound and fury, signifying nothing) here recently about allocation of large memory blocks. I'm about to start on a personal pet project where I'll be using...
5
by: jab3 | last post by:
(again :)) Hello everyone. I'll ask this even at risk of being accused of not researching adequately. My question (before longer reasoning) is: How does declaring (or defining, whatever) a...
13
by: chellappa | last post by:
hi , please explain me , char pointer , char Array, char ,string... i have some many confussion about this... please clarify to me.. i need some example about this program by chellappa.ns
7
by: brian_harris | last post by:
I have a string object that I need to convert into an unmanged char * to be used by several unmnaged 3rd party functions. I have tried to use: (Marshal::StringToHGlobalAuto (Profname)) This would...
3
by: kaizen | last post by:
Hi, i wrote the code in C and compiled in VC++ compiler. at that time it has thrown the below mentioned error. error C2664: 'strcpy' : cannot convert parameter 2 from 'char' to 'const char *'...
1
by: weird0 | last post by:
System.Data.SqlClient.SqlException: An attempt to attach an auto- named database for file "Location" failed. A database with the same name exists, or specified file cannot be opened, or it is...
1
by: rahim | last post by:
Unable to wirte a txt file using ASP FileSystemObject
2
by: ahmurad | last post by:
Dear Brothers, I am using a 'text file location' at my code to read the file contents- which is working fine in my local server. The web contents/php files and the specified txt file are at the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.