Solved

What is parameter 4 in WriteFile()

Posted on 2000-02-22
1
389 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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

  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 …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now