Solved

What is parameter 4 in WriteFile()

Posted on 2000-02-22
1
418 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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
Building cUrl in Windows v7.43.0 4 39
Task manager indicates my c++ program memory consumption is growing? 12 139
c++ syntax question 9 58
Finding Divisors 5 37
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

756 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