VOGONS

Common searches


First post, by nachiketh

User metadata
Rank Newbie
Rank
Newbie

Hi Folks,
So i'm running DOSBox on a Ubuntu machine to run a DOS application. My application creates a file which gets written to during the course of the application's execution. I'm seeing that the file does not get written to on my Linux file file system until DOSBox is exited or killed. Is this a known behaviour of DOSBox, is there any configuration that can flush the data to the Linux file system as and when it gets written to by my application. If anyone has faced something similar, please let me know.
Cheers! 😁

Reply 1 of 5, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

That's odd. Haven't experienced that before.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 2 of 5, by Jorpho

User metadata
Rank l33t++
Rank
l33t++

Are you sure that the DOS application isn't writing the file only when the application exits?

CTRL-F4 is used to force DOSBox to re-read the current directory structure, but I don't think that has anything to do with writing to disk.

Reply 3 of 5, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

DOSBox, like most C programs, uses write buffering (see here) for better performance. The data is written to disk when the buffer becomes full, so I guess the application is only writing a small amount and then leaving the file open. Closing a file will, of course, write all data to disk; and because it's your application you may be able to add more frequent closing.

Some time ago I made a TSR program (see here) to run inside DOSBox that has the effect of flushing writes to disk immediately. It was intended as a workaround for a particular issue with a game that has since been resolved, but it may be effective for your purpose. However, do note that it mostly negates the performance benefits of the buffering.

Reply 4 of 5, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

True. How do you determine that the file is not there? Through the app in Dosbox (then the ctrl-f4 is important) or through. File manager in your host.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 5 of 5, by nachiketh

User metadata
Rank Newbie
Rank
Newbie
ripsaw8080 wrote:

DOSBox, like most C programs, uses write buffering (see here) for better performance. The data is written to disk when the buffer becomes full, so I guess the application is only writing a small amount and then leaving the file open. Closing a file will, of course, write all data to disk; and because it's your application you may be able to add more frequent closing.
Some time ago I made a TSR program (see here) to run inside DOSBox that has the effect of flushing writes to disk immediately. It was intended as a workaround for a particular issue with a game that has since been resolved, but it may be effective for your purpose. However, do note that it mostly negates the performance benefits of the buffering.

Unfortunately it is not my application, its a 3rd party DOS exe which does some data crunching to generate a bin file 😐 and since its a legacy application (1998 to be precise) I do not have the source code of the same to add the fflush

Dominus wrote:

True. How do you determine that the file is not there? Through the app in Dosbox (then the ctrl-f4 is important) or through. File manager in your host.

Jorpho wrote:

Are you sure that the DOS application isn't writing the file only when the application exits?

So this is how I checked:

  • 1. I started DOSBox and launched my application
    2. Application creates a file test.bin
    3. The size of test.bin is 0 (The usual behaviour on my windows machine is the size of test.bin increases)
    4. I quit the DOSBox window and test.bin is now showing 1024 Bytes as the size

I'm wondering if its got anything to do with the my Ubuntu system settings, will read that up a little to see if there is anything on the system that I need to tweak to ensure the file gets written to immediately. If you guys have any other ideas, please let me know! cheers!