Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Can I update & append a text file with a single open?

Hello All,

If memory serves, opening a text file with "r+" allows updates and "a" allows append.  Is there an option that does both, or does "r+" also allow appends if the write is done at the end of the file?

Thanks!
0
quiTech
Asked:
quiTech
1 Solution
 
AxterCommented:
>>Is there an option that does both, or does "r+" also allow appends if the write is done at the end of
>>the file?

Yes, "r+" does allow appends.
You can call the seek command to move the file position to the end of the file, so you can do an append.
0
 
quiTechAuthor Commented:
Great, thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now