Jump to content

Append a string of text to the end of a line


Go to solution Solved by iamtheky,

Recommended Posts

Posted (edited)
Hello all, I was wondering if anybody around here could help me with a little problem. Is there is a method I can use to append a string of text to the end of a line inside a text file? I've been browsing all over the forums here and there are lots of answers that are really close, but I have not found a solution that has actually worked for me. A few I didn't even really understand but tried anyway, with no luck.
 
The function:  
FileWriteLine($LOG, "FText")
just adds a whole new line at the bottom, while the function:  
_FileWriteToLine($LOG, 1, "FText", 0)
adds the the letters "FText" to the beginning of the first line in the log file.  
  
I am sure the answer is already burried somewhere in this forum, but I can't seem to find it.
Is there any way I can add this text to the end of the first line, instead of the beginning? 
 
 
ps. Thank you for your time.
Edited by Heretic
  • Solution
Posted (edited)

How about $line = FileReadLine($LOG, 1) first, then you _FileWriteToLine($LOG, 1, $line & "FText", 1).

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted

How about $line = FileReadLine($LOG, 1) first, then you _FileWriteToLine($LOG, 1, $line & "FText", 1).

Yep, That'll do it.  

Thank-you kindly, sir.

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
  • Recently Browsing   0 members

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