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 30927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:31:29+00:00 2026-05-10T13:31:29+00:00

I have to develop an application which parses a log file and sends specific

  • 0

I have to develop an application which parses a log file and sends specific data to a server. It has to run on both Linux and Windows.

The problem appears when I want to test the log rolling system (which appends .1 to the name of the creates a new one with the same name). On Windows (haven’t tested yet on Linux) I can’t rename a file that I have opened with std::ifstream() (exclusive access?) even if I open it in ‘input mode’ (ios::in).

Is there a cross-platform way to open file in a non-exclusive way?

  • 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. 2026-05-10T13:31:29+00:00Added an answer on May 10, 2026 at 1:31 pm

    Is there a way to open file in a non-exclusive way,

    Yes, using Win32, passing the various FILE_SHARE_Xxxx flags to CreateFile.

    is it cross platform?

    No, it requires platform-specific code.

    Due to annoying backwards compatibility concerns (DOS applications, being single-tasking, assume that nothing can delete a file out from under them, i.e. that they can fclose() and then fopen() without anything going amiss; Win16 preserved this assumption to make porting DOS applications easier, Win32 preserved this assumption to make porting Win16 applications easier, and it’s awful), Windows defaults to opening files exclusively.

    The underlying OS infrastructure supports deleting/renaming open files (although I believe it does have the restriction that memory-mapped files cannot be deleted, which I think isn’t a restriction found on *nix), but the default opening semantics do not.

    C++ has no notion of any of this; the C++ operating environment is much the same as the DOS operating environment–no other applications running concurrently, so no need to control file sharing.

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

Sidebar

Related Questions

I have to develop an application using C#.net that has to be run once
I have to develop an Android application which should access a specific version of
I have to develop an application, which will request to a web service developed
I have to develop an application which includes following things, => Make a request
I have to develop a application in .net technology which calls an external service
I have to develop an application which takes PDF as input, that PDF document
I'm planning to develop a web application which will have many static pages (about,
Say suppose 10 developers have taken 6 months to develop some application. As a
I am using asp.net MVC to develop an application that will have ajax interactions.
I have a quick little application and wanted to give a try to develop

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.