Sign in to follow this  
Followers 0
Heretic

Append a string of text to the end of a line

3 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Edited by boththose

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

Share this post


Link to post
Share on other sites

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

Yep, That'll do it.  

Thank-you kindly, sir.

Share this post


Link to post
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
Sign in to follow this  
Followers 0