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

OverWrite a line of text?

I coulda sworn it was possible to overwrite specific lines in a text file
without disturbing the rest, or was that in C++?

Will a TextWriter object do this?

Eric B.

Oct 16 '08 #1
2 2995
On Oct 16, 8:02*am, "Eric B." <bigb...@sesamestreet.comwrote:
I coulda sworn it was possible to overwrite specific lines in a text file
without disturbing the rest, or was that in C++?

Will a TextWriter object do this?
Is the new line of text *exactly* the same size (in bytes, after
encoding) as the old line? If so, it's possible. It not, it's not. You
can't just arbitrarily insert and delete data from the middle of
files.

Jon
Oct 16 '08 #2
You could script edlin to change a line. That brings back memories! Under
the hood I'm sure it's not different then the following:

string [] lines = File.ReadAllLines("somefile.txt");
lines [someline] = "a new line";
File.WriteAllLines ("somefile.txt", lines);
"Eric B." <bi*****@sesamestreet.comwrote in message
news:DD**********************************@microsof t.com...
>I coulda sworn it was possible to overwrite specific lines in a text file
without disturbing the rest, or was that in C++?

Will a TextWriter object do this?

Eric B.
Oct 16 '08 #3

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

Similar topics

13
by: Dan V. | last post by:
How do I create a one line text file with these control codes? e.g.: 144 = 0x90 and 147 = 0x93? I am trying to create a one line text file with these characters all one one row with no spaces. ...
3
by: Jow Blow | last post by:
I am trying to make a word wrap type function for a multi line text box field that will be saved to a text file. The word wrap property looks good in the app but when saved to a text file the line...
1
by: Mike L | last post by:
This is for a Win form. I am able to send a string to my multi line text box, but I want the string to have hard returns in it. Here is my code for the string. string s =...
3
by: Kieran Breen | last post by:
Hiya, I was just wondering if anyone knows how to impose a maximum length on a muti line text box in asp.net. There is a parameter for this but even when its set it dosent seem to make any...
9
by: C.K | last post by:
Can I enter a two-line text description on a button, chr(13) doesn't seem to do anything ?
1
by: amruta | last post by:
I need to write something like this in the multi line text box dynamically as the value is obtained. how can i do it example: abce 1232 qwert asdfg qwqw ghdjhfj ...
8
by: MLH | last post by:
Am trying to import 20,000+ lines of text in a file FTP'd from a UNIX platform to windows via FTP session in a DOS box. About 2000 records have multiple lines in them separated by CRLF's. ...
8
by: cj | last post by:
I use multi-line text boxes with vertical scroll bars in several of my programs to display log information as the programs run. Once the text more than fills the visible portion of the textbox I...
2
by: shihab | last post by:
I have created two text boxes,One is single line text box other is multiline. On button click i want to 'add text from single text box to Multiline text box'one by one. please give solution for...
4
by: skanemupp | last post by:
using python And tkinter. i have a GUI that outputs a text among other things. after input form user i want this text to be *)cleared and/or *)overwritten. what is the best way to achieve...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.