Link to home
Start Free TrialLog in
Avatar of turbot_yu
turbot_yuFlag for Singapore

asked on

How to clean all the txt in a txt file and then put a paragraph in it

Hi, Experts,

Is there any way to clean all the txt in the txt file firts and then put a paragraph in it.

Thanks,

Turbot
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MarioLeo
MarioLeo

What I always do is simply close the file, kill it and then create another file with the new content : 3 lines of code, hassle -free

Regards,

Mario
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Instead of opening the file in append mode just open it in output mode and it will overwrite whatever is there.

open "Filename.txt" for output as #1
write #1, "paragraph"
close #1
Its been more than 21 days since a comment has been made. I am leaving this for cleanup.
Recommend: Split: ryancys , shijusn
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:

[Split: ryancys and shijusn]

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

egl1044
EE Cleanup Volunteer