Sign in to follow this  

async file writing

This topic is 3458 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! My game writes huge data size to a file. I want to use async file writing. I develop my game at VS2003. In this game I write data to file using fwrite method, because it is a multi-platform one. But this method is not asynchronous method. In msdn I founded _fwrite_nolock method. This what I need, BUT I use VS2003, and in this version of "stdio" library this method is absent. !! Help me please!

Share this post


Link to post
Share on other sites
Sorry, there's no platform independent async fwrite function. From what I gather you can create one yourself! If you're not comfortable with threads, that would be a great learning project.

There are tons of way to do this!

Share this post


Link to post
Share on other sites
Quote:
Original post by fboivin
Sorry, there's no platform independent async fwrite function. From what I gather you can create one yourself! If you're not comfortable with threads, that would be a great learning project.


Threads don't bring much to the table in this case.

Windows supports overlapped IO. That one is the basis for all async IO, even files.

Under Linux, aio should serve the same purpose, but I've never looked into whether and how it works with files. But since everything is a file under Linux, intuition says it works.

But right now, I'm not aware of any out-of-box library that would support this.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mike nl
Nor are there really platform independent ways to create threads :)


Assuming you're using C++, boost::thread can be considered platform independent. Not only is it written to support native threads on a more than a couple of platforms, it is marked for inclusion in the next version of the C++ standard library.

Just something worth condsidering.



Share this post


Link to post
Share on other sites
Quote:
Original post by kitkit
Thanks you for you answers!!! I found such decision: I used a pthread library and fwrite method. Thanks, one more time... topic closed!


Just keep in mind that you're not doing asynchronous writing, you're doing writing in a thread. That's a different thing.

Share this post


Link to post
Share on other sites

This topic is 3458 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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