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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:38:08+00:00 2026-05-29T07:38:08+00:00

Im trying to use the WriteFile function. Ive been working off this example http://msdn.microsoft.com/en-us/library/ms900134.aspx

  • 0

Im trying to use the WriteFile function. Ive been working off this example

http://msdn.microsoft.com/en-us/library/ms900134.aspx

Here the buffer that is passed to WriteFile is filled from ReadFile. But I dont want to do it that way. I just want to write a string like “Example text testing WriteFile” or something. But im not sure what values the parameters should have. Ive tried looking around on google but couldnt find anything. Anyone know how i do this?

  • 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-29T07:38:10+00:00Added an answer on May 29, 2026 at 7:38 am

    From MSDN:

    BOOL WINAPI WriteFile(
      __in         HANDLE hFile,
      __in         LPCVOID lpBuffer,
      __in         DWORD nNumberOfBytesToWrite,
      __out_opt    LPDWORD lpNumberOfBytesWritten,
      __inout_opt  LPOVERLAPPED lpOverlapped
    );
    
    • The first argument is the handle to the file.
    • The second argument is a pointer to the data you want to write. In your case it’s the string.
    • The third argument is the length of the data you want to write. In your case it will be something like strlen(str).
    • The fourth argument is a pointer to a DWORD variable that will receive the number of bytes actually written.
    • The fifth and last parameter can be NULL for now.

    You use it like this:

    char str[] = "Example text testing WriteFile";
    DWORD bytesWritten;
    
    WriteFile(fileHandle, str, strlen(str), &bytesWritten, NULL);
    

    If WriteFile returns FALSE then there was an error. Use the GetLastError function to find out the error code.

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

Sidebar

Related Questions

I am trying to do the following: http://msdn.microsoft.com/en-us/library/dd456857.aspx I created the function in the
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I am trying to find a way to use C++ classes in D. http://www.digitalmars.com/d/2.0/cpp_interface.html
Trying to use this method (gist of which is use self.method_name in the FunnyHelper
Trying to use this code to connect the AD PrincipalContext context = new PrincipalContext(ContextType.Domain,
trying to use regex to replace any white space with  , inside of example
This is a Cocoa app I am working on. I'm trying to embed a
Im trying to use the ReplaceChild function. the code works, and no exceptions are
I am trying to use the timer class in C# for this TCM Updater
Trying to understand this MSDN sample but I'm confused about these lines: IAsyncResult result

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.