473,382 Members | 1,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

type casting problem

I do the following:

->Lock( 0, 0, (BYTE**)&pVertices, DUSAGE_WRITEONLY )

And get the following error:

error C2664: 'Lock' : cannot convert parameter 3 from 'unsigned char ** ' to
'void ** '

Any ideas?

Regards,
Venn
Jul 22 '05 #1
5 1514
What is the type of pVertices?
What is the specification of Lock?
What is BYTE? Some MS specific typedef for unsigned char?

Venn Syii wrote:
I do the following:

->Lock( 0, 0, (BYTE**)&pVertices, DUSAGE_WRITEONLY )

And get the following error:

error C2664: 'Lock' : cannot convert parameter 3 from 'unsigned char ** '
to 'void ** '

Any ideas?

Regards,
Venn


Jul 22 '05 #2
Venn Syii wrote:
I do the following:

->Lock( 0, 0, (BYTE**)&pVertices, DUSAGE_WRITEONLY )

And get the following error:

error C2664: 'Lock' : cannot convert parameter 3 from
'unsigned char ** ' to 'void ** '

Any ideas?


Apparently BYTE is a typedef of unsigned char.

It looks like the Lock member function wants void **, not unsigned char
**. So don't use BYTE **; use void **. Check its documentation or
declaration to be sure though.

--
Dave O'Hearn

Jul 22 '05 #3
Venn Syii wrote:
I do the following:

->Lock( 0, 0, (BYTE**)&pVertices, DUSAGE_WRITEONLY )

And get the following error:

error C2664: 'Lock' : cannot convert parameter 3 from 'unsigned char ** ' to
'void ** '

Any ideas?


How is 'Lock' function declared? If it's a class, what the declaration
of its constructor? And why are you trying to cast '&pVertices' to
'BYTE**'? Your compiler is telling you that it expects a pointer to
a pointer to void as the third argument. What's the documentation say
about the use of the third argument?

V
Jul 22 '05 #4
Dave O'Hearn wrote:
Apparently BYTE is a typedef of unsigned char.

It looks like the Lock member function wants void **, not
unsigned char **. So don't use BYTE **; use void **. Check its
documentation or declaration to be sure though.


It must be early in the morning. I forgot to note that casts to void
pointers are often implicit. So you can simply try deleting your cast.
--
Dave O'Hearn

Jul 22 '05 #5
Dave O'Hearn wrote:
Dave O'Hearn wrote:
Apparently BYTE is a typedef of unsigned char.

It looks like the Lock member function wants void **, not
unsigned char **. So don't use BYTE **; use void **. Check its
documentation or declaration to be sure though.

It must be early in the morning. I forgot to note that casts to void
pointers are often implicit. So you can simply try deleting your cast.


There is a standard conversion from T* to void*, but he cannot delete
the cast (although he can certainly try), since there is no standard
conversion from T** to void**. Example:

void foo(void **p) {}

int main()
{
void *pv = 0;
foo(&pv); // OK
unsigned char *pc = 0;
foo(&pc); // error
}

Victor
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Richard Myers | last post by:
Hello. I am getting an InvalidCastException which has revealed yet more of my ignorance. I cant believe i dont already know this and haven't encountered it before until now. I am consuming a...
1
by: wenmang | last post by:
Hi, I have a third party function that has a following signature: function(char * memoryBuffer, long bufferSize); I want to following Base64::decode() from Apache's XML C++ APIs: XMLByte*...
4
by: Jacob Jensen | last post by:
This question has probably been asked a million time, but here it comes again. I want to learn the difference between the three type cast operators: static_cast, reinterpret_cast, dynamic_cast. A...
10
by: Bob | last post by:
This has been bugging me for a while now. GetType isn't availble for variables decalred as interface types, I have to DirectCast(somevariable, Object). In example: Sub SomeSub(ByVal...
23
by: René Nordby | last post by:
Hi there, Is there anyone that knows how to do the following? I have a class A and a class B, that 100% inherits from class A (this means that I don't have other code in class B, than...
7
by: Martin Robins | last post by:
I am currently looking to be able to read information from Active Directory into a data warehouse using a C# solution. I have been able to access the active directory, and I have been able to return...
16
by: Enekajmer | last post by:
Hi, 1 int main() 2 { 3 float a = 17.5; 4 printf("%d\n", a); 5 printf("%d\n", *(int *)&a); 6 return 0; 7 }
8
by: Kris Jennings | last post by:
Hi, I am trying to create a new generic class and am having trouble casting a generic type to a specific type. For example, public class MyClass<Twhere T : MyItemClass, new() { public...
15
by: shuisheng | last post by:
Dear All, Assume I have a class named Obj. class Obj { }; And a class named Shape which is derived from Obj. class Shape: public Obj
8
by: Smithers | last post by:
Are there any important differences between the following two ways to convert to a type?... where 'important differences' means something more profound than a simple syntax preference of the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.