473,809 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Editing text files

ALF
What's easiest way to replace a particular text string in
a text file by another and save the modified file?

Currently I know how to open a file, read the text
string, place it in a variable, and modify the string.
What I'd like to know is how to save the modified string
in the same file.

The alternative that's I'm trying to avoid is to create a
temporary auxiliary file in the process.

Any help is appreciated

Thanks
ALF
Nov 20 '05 #1
4 1141
Cor
Hi ALF,

Is it a textfile form one string or a textfile with lines with CRLF in it?

Cor
Nov 20 '05 #2
ALF
It is a text file with lines with CRLF in it.
-----Original Message-----
Hi ALF,

Is it a textfile form one string or a textfile with lines with CRLF in it?
Cor
.

Nov 20 '05 #3
* "ALF" <an*******@disc ussions.microso ft.com> scripsit:
It is a text file with lines with CRLF in it.


I think the way to go depends on the size of the file. The solution
will be different if files are always very small and if the file's size
is 2 GB.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
ALF
The file size will never exceed 4 MB.

ALF
-----Original Message-----
* "ALF" <an*******@disc ussions.microso ft.com> scripsit:
It is a text file with lines with CRLF in it.
I think the way to go depends on the size of the file.

The solutionwill be different if files are always very small and if the file's sizeis 2 GB.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
.

Nov 20 '05 #5

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

Similar topics

4
2407
by: Dan Weeb | last post by:
Hi All, I have struggled through this far with help from many of you so thanks. I am stuck again. I am really new to this so don't be harsh :-) There are a few problems. You can run the script here http://www.pbrown.com/research/test1.php to see the formatting issues Formatting Issues
1
1690
by: sam.collett | last post by:
Is there a basic guide on Xml document creation and editing (simpler than the MSDN docs). Say I want to create a file containing the following: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <Files> <File> <Text>Test</Text> <Name>Test.html</Name> </File>
2
4269
by: NewBob | last post by:
Since Access automatically highlights all of the text in a text control (I use it to hold data from a memo field) when the control is activated, I've added the following code to put the cursor at the end. Private Sub txtCapability_GotFocus() ‘ Placed either behind the OnEnter or GotFocus Event of a control named, ' in this case, txtCapability, on a form ensures that when the control is
1
1676
by: pratyush.aditya | last post by:
hi, can anybody tell me what are the steps and procedures that are to be taken for video editing like frame extraction etc from avi,mpeg files using C programming.
0
1278
by: Art Decco | last post by:
For some reason I was under the impression that .Net's RichTextBox supported drag and drop editing, but if it does, I don't see how to turn it on. I'm not talking about dragging files or images or whatever from some other app into the RichTextBox. I'm just talking about the common editing technique that is supported by nearly every MS app (incl. the VS editor itself and the Outlook Express I'm writing this with) where you select some...
8
11362
by: Sam Collett | last post by:
Is there a basic guide on Xml document creation and editing (simpler than the MSDN docs). Say I want to create a file containing the following: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <Files> <File> <Text>Test</Text> <Name>Test.html</Name> </File>
12
3105
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty asp editing (like I used to be able to do with 2K/IIS5) where I use VS.NET, open an asp file, make changes, save and refresh my browser. Problem is that I get an Access is Denied error when I try to save the file and then the file gets wiped on...
14
1436
by: James | last post by:
I compile my code, I get a few errors, I go to the 1st error in the editor and start to type in the correct code and I get no where because with each key stroke the caret goes away, then a long pause and then the carey comes back showing one character entered so it's like this:: SomeObject.D ... long pause ... SomeObject.Do ... long pause ... SomeObject.DoS ... long pause ... SomeObject.DoSo ... long pause ... SomeObject.DoSom ... long...
1
2724
by: zivon | last post by:
now for the bigger problam :) I know you pepole hate using OE for sending emails, but its user friendly and its needed in this case... I found on this forum, a code that sends email using OE with attachments. it works, but with two problams... first, its directly sends the email, without opening the OE "editing mode" of the email, like when you use the DoCmd.SendObject. this is the smaller problams though... the bigger problam...
7
3724
by: JeremyWoertink | last post by:
I have an app that I need to make changes to, and on my local copy I have a start.aspx.vb file that I edited and tested, now when I go to the app on the server, it doesn't show any of the .vb files, only the .aspx files. How can I make it show me the .vb file? ~Jeremy
0
9721
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, 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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10633
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10114
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3860
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.