#5296 - Saj - Thu Apr 24, 2003 7:27 pm
Hey,
This may seem off-topic but it's not because I'm going to use it in a GBA Dev Tool.
(It's a Win32 App and I'm using VC++ to create it.)
Anyways, I'm trying to get this code to work. It's from a tutorial
(http://winprog.org/tutorial/)(App part 1 and part 2)
To simplify, These are the lines I'm having problems with :-
The errors I get are :-
I've tried to do the first 2 casts explicitly :-
Will this work? I can't test it because of the (line 74) 'WriteFile' Error. :(
Please hep me to do the casts or whatever else that may fix it...
Thanks.
_________________
---------------------------------------------------
Click here to give free food to starving animals.
--------------------------------------------------
Last edited by Saj on Mon Apr 28, 2003 9:32 am; edited 3 times in total
This may seem off-topic but it's not because I'm going to use it in a GBA Dev Tool.
(It's a Win32 App and I'm using VC++ to create it.)
Anyways, I'm trying to get this code to work. It's from a tutorial
(http://winprog.org/tutorial/)(App part 1 and part 2)
Code: |
Edited: A big slab of code was here but I removed it for the sake of not wasting forum space. |
To simplify, These are the lines I'm having problems with :-
Code: |
pszFileText = GlobalAlloc(GPTR, dwFileSize + 1); // line 29 - Error here! |
Code: |
pszText = GlobalAlloc(GPTR, dwBufferSize); // line 67 - Error here! |
Code: |
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL)) // line 74 - Error here! |
The errors I get are :-
Code: |
C:\Projects\Win\win3\win3.cpp(29) : error C2440: '=' : cannot convert from 'void *' to 'char *' Conversion from 'void*' to pointer to non-'void' requires an explicit cast C:\Projects\Win\win3\win3.cpp(67) : error C2440: '=' : cannot convert from 'void *' to 'char *' Conversion from 'void*' to pointer to non-'void' requires an explicit cast C:\Projects\Win\win3\win3.cpp(74) : error C2664: 'WriteFile' : cannot convert parameter 4 from 'unsigned short *' to 'unsigned long *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. |
I've tried to do the first 2 casts explicitly :-
Code: |
pszText = (LPSTR)GlobalAlloc(GPTR, dwBufferSize); |
Will this work? I can't test it because of the (line 74) 'WriteFile' Error. :(
Please hep me to do the casts or whatever else that may fix it...
Thanks.
_________________
---------------------------------------------------
Click here to give free food to starving animals.
--------------------------------------------------
Last edited by Saj on Mon Apr 28, 2003 9:32 am; edited 3 times in total