Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

What is parameter 4 in WriteFile()

Posted on 2000-02-22
1
412 Views
Last Modified: 2008-03-06
I face a problem to insert the proper lpNumberOfBytesWritten which is the parameter 4 in WriteFile(). after build, it show error "cannot convert parameter 4 from 'int *' to 'unsigned long *'. i'm sending 1 byte of data to hDevice. WriteFile(hDevice,nPtr,1,1,NULL). what's wrong with the command?
thanks.
0
Comment
Question by:giggs11
1 Comment
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 2548677
The problem is that an int is signed, but it wants an unsigned value (actually a pointer to an unsigned value.)  Since the parameter is declared as LPDWORD (i.e a pointer to a DWORD) Try

DWORD BytWrt;

WriteFile(hDevice,nptr,1,&BytWrt,NULL)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Handle Exceptions during instantiation 28 422
C++ get user from AD  (VS6) 7 82
Writing a parser for java language 4 83
Need some help with mailto 16 20
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question