Jump to content

Delete and write a line in a file


akorx
 Share

Recommended Posts

Hi Guys,

Is there a way to delete a line (i know the line numer to delete for exemple it's line 5) of a file and then write another line to this place ?

I know a way :

- load all the file in an array

- do an string replace

- delete the file and write the array in the same file

... but I would like to avoid (i'm french, please help me : we say "would like to avoid" or "would like avoid" ?, :) ) to use an array because my file is very very big. So how can i do ?

AkorxMail akorx@yahoo.fr

Link to comment
Share on other sites

  • Moderators

Hi, akorx. _FileWriteToLine should work for this:

#include <file.au3>

_FileWriteToLine(@DesktopDir & "Test.txt", 5, "Test 12345", 1)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hi, akorx. _FileWriteToLine should work for this:

#include <file.au3>

_FileWriteToLine(@DesktopDir & "Test.txt", 5, "Test 12345", 1)

Ok thanks a lot for your help JLogan3o13 ! i have never seen that there were functions with "_File..." . Each time i was making them !!!

If you got ime don't forget to correct my bad english !

Thx again from France !

AkorxMail akorx@yahoo.fr

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...