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

  • Home
  • SEARCH
  • 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 49871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:30:16+00:00 2026-05-10T16:30:16+00:00

I am using VB6 and the Win32 API to write data to a file,

  • 0

I am using VB6 and the Win32 API to write data to a file, this functionality is for the export of data, therefore write performance to the disk is the key factor in my considerations. As such I am using the FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH options when opening the file with a call to CreateFile.

FILE_FLAG_NO_BUFFERING requires that I use my own buffer and write data to the file in multiples of the disk’s sector size, this is no problem generally, apart from the last part of data, which if it is not an exact multiple of the sector size will include character zero’s padding out the file, how do I set the file size once the last block is written to not include these character zero’s?

I can use SetEndOfFile however this requires me to close the file and re-open it without using FILE_FLAG_NO_BUFFERING. I have seen someone talk about NtSetInformationFile however I cannot find how to use and declare this in VB6. SetFileInformationByHandle can do exactly what I want however it is only available in Windows Vista, my application needs to be compatible with previous versions of Windows.

  • 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-10T16:30:17+00:00Added an answer on May 10, 2026 at 4:30 pm

    I’m not sure, but are YOU sure that setting FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH give you maximum performance?

    They’ll certainly result in your data hitting the disk as soon as possible, but that sort of thing doesn’t actually help performance – it just helps reliability for things like journal files that you want to be as complete as possible in the event of a crash.

    For a data export routine like you describe, allowing the operating system to buffer your data will probably result in BETTER performance, since the writes will be scheduled in line with other disk activity, rather than forcing the disk to jump back to your file every write.

    Why don’t you benchmark your code without those options? Leave in the zero-byte padding logic to make it a fair test.

    If it turns out that skipping those options is faster, then you can remove the 0-padding logic, and your file size issue fixes itself.

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

Sidebar

Ask A Question

Stats

  • Questions 67k
  • Answers 67k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer We require register tag <%@ Register Src='../../UserControls/RoundedButton.ascx' TagName='RoundedButton' TagPrefix='ttl' %> May 11, 2026 at 12:03 pm
  • added an answer You can use something like this: Iterator<MemoryPoolMXBean> iter = ManagementFactory.getMemoryPoolMXBeans().iterator();… May 11, 2026 at 12:03 pm
  • added an answer From the Codesearch FAQ: What programming languages do you support?… May 11, 2026 at 12:03 pm

Related Questions

I am using VB6 and the Win32 API to write data to a file,
I need the current user and the domain. I am using a VB 6
I am trying to uncompress some data created in VB6 using the zlib API.
I am using SQL Server 2005. I have a table with a text column
I am using LINQ to query a generic dictionary and then use the result
I am using Hibernate in a Java application to access my Database and it
I am using MSBuild to build my stuff. I want to use CruiseControl.net as
I am using Java back end for creating an XML string which is passed
I am using ASP.NET Dynamic Data for a project and I have a table
I am using the Photoshop's javascript API to find the fonts in a given

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.