Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 315227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:16:20+00:00 2026-05-12T08:16:20+00:00

According to the documentation of open function ‘a’ means appending, which on some Unix

  • 0

According to the documentation of open function
‘a’ means appending, which on some Unix systems means that all writes append to the end of the file regardless of the current seek position.

Will ‘a+’ allow random writes to any position in the file on all systems?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:16:20+00:00Added an answer on May 12, 2026 at 8:16 am

    On my linux system with Python 2.5.2 writes to a file opened with ‘a+’ appear to always append to the end, regardless of the current seek position.

    Here is an example:

    import os
    
    if __name__ == "__main__":
    
        f = open("test", "w")
        f.write("Hello")
        f.close()
    
        f = open("test", "a+")
        f.seek(0, os.SEEK_SET)
        f.write("Goodbye")
        f.close()
    

    On my system (event though I seeked to the beginning of the file) this results in the file “test” containing:

    HelloGoodbye

    The python documentation says that the mode argument is the same as stdio’s.

    The linux man page for fopen() does say that (emphasis added):

    Opening a file in append mode (a as
    the first character of mode) causes
    all subsequent write operations to
    this stream to occur at end-of-file,
    as if preceded by an

    fseek(stream,0,SEEK_END);
    

    call.

    My stdio reference says that appending a ‘+’ to the mode (i.e. ‘a+’) means that the stream is opened for input and output. However before switching between input and output a call must be made to explicitly set the file position.

    So adding the ‘+’ doesn’t change the fact that on some systems writes for a file opened in ‘a’ or ‘a+’ mode will always append to the end of the file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are integrating documentation authored according to DITA. The DITA Open Toolkit processes all
According to the documentation, the decimal.Round method uses a round-to-even algorithm which is not
According to the documentation in VB6 the Mid() function returns a variant, but Mid$()
I'm trying to use the function XLookupString . According to the documentation , it
According to ADC documentation: You can access Open Firmware this by holding down Command-Option-O-F
According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to
According to the documentation, a prepared query provides a significant performance benefit if you're
According to the documentation of the == operator in MSDN , For predefined value
According to the documentation of java.util.Pattern , the POSIX character class \p{Graph} ( [:graph:]
According to the documentation : There is no way to block signals temporarily from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.