Click here to Skip to main content
15,890,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Is it possible to have an array of types ? Pin
Code-o-mat9-Dec-08 0:36
Code-o-mat9-Dec-08 0:36 
GeneralRe: Is it possible to have an array of types ? Pin
Defenestration9-Dec-08 0:48
Defenestration9-Dec-08 0:48 
GeneralRe: Is it possible to have an array of types ? Pin
Code-o-mat9-Dec-08 1:19
Code-o-mat9-Dec-08 1:19 
GeneralRe: Is it possible to have an array of types ? Pin
Defenestration9-Dec-08 1:27
Defenestration9-Dec-08 1:27 
QuestionRe: Is it possible to have an array of types ? Pin
David Crow9-Dec-08 3:14
David Crow9-Dec-08 3:14 
AnswerRe: Is it possible to have an array of types ? Pin
Michael Dunn9-Dec-08 13:52
sitebuilderMichael Dunn9-Dec-08 13:52 
QuestionHow to unblock pipe write operation? Pin
sashoalm8-Dec-08 21:39
sashoalm8-Dec-08 21:39 
QuestionNeed some Bits/Bytes and Types information Pin
gabbana8-Dec-08 21:24
gabbana8-Dec-08 21:24 
Hy,

I am still having problem handling some data types and the data itself in memory and so on.

For example: For getting the text of an edit control (winapi) requires to create a buffer with enaugh space. I did (unicode) for example:

length is from the type of WORD in the example, but i used length as an integer.

TCHAR *buf = new TCHAR[length+1];

So now it says the FIRST WORD needs to have the length of the string in the edit field, which I retrieved before.

The example shows:

*((LPWORD)buf) = length;

However, when I use my way: *(buf) = length it ends in the same result.


So, my question is whats so special in the way how msdn do it?


-----
And then, did i understand the line right ? Here is my explanation:

In memory we have allocated space for the variable buf. The length is the length of TCHAR * mylength(the variable)
But in memory it is handled as "we need xx bytes" right?

Then *(buf) points to the first byte (in array it is index 0)

But because we need the first word, we convert the normal pointer (i think normal is a void pointer) to an pointer of a WORD. So now the index 0 for examples is exactly 1 WORD.

Then we write the length variable which is also a WORD to the location.


Is this right or do I misunderstand something?

----

And why is my way *(buf) = length also working?


I hope everybody understand whats my problem. Thank you for help.

bye,
gabbana
AnswerRe: Need some Bits/Bytes and Types information Pin
CPallini8-Dec-08 22:16
mveCPallini8-Dec-08 22:16 
AnswerRe: Need some Bits/Bytes and Types information Pin
Code-o-mat8-Dec-08 22:22
Code-o-mat8-Dec-08 22:22 
AnswerRe: Need some Bits/Bytes and Types information Pin
gabbana8-Dec-08 22:32
gabbana8-Dec-08 22:32 
GeneralRe: Need some Bits/Bytes and Types information Pin
gabbana8-Dec-08 22:35
gabbana8-Dec-08 22:35 
GeneralRe: Need some Bits/Bytes and Types information Pin
Code-o-mat8-Dec-08 23:00
Code-o-mat8-Dec-08 23:00 
GeneralRe: Need some Bits/Bytes and Types information Pin
gabbana9-Dec-08 0:51
gabbana9-Dec-08 0:51 
Questiondifference between CreateThread & AfxBeginThread Pin
Nikesh Jagtap8-Dec-08 21:17
Nikesh Jagtap8-Dec-08 21:17 
AnswerRe: difference between CreateThread & AfxBeginThread Pin
Roger Stoltz8-Dec-08 21:27
Roger Stoltz8-Dec-08 21:27 
AnswerRe: difference between CreateThread & AfxBeginThread [modified] Pin
Defenestration8-Dec-08 22:32
Defenestration8-Dec-08 22:32 
AnswerRe: difference between CreateThread & AfxBeginThread Pin
Roger Stoltz8-Dec-08 22:42
Roger Stoltz8-Dec-08 22:42 
GeneralRe: difference between CreateThread & AfxBeginThread Pin
Defenestration8-Dec-08 22:51
Defenestration8-Dec-08 22:51 
QuestionHow to write string values in .csv file Pin
MsmVc8-Dec-08 20:40
MsmVc8-Dec-08 20:40 
AnswerRe: How to write string values in .csv file Pin
Cedric Moonen8-Dec-08 20:51
Cedric Moonen8-Dec-08 20:51 
AnswerRe: How to write string values in .csv file Pin
SandipG 8-Dec-08 20:52
SandipG 8-Dec-08 20:52 
GeneralRe: How to write string values in .csv file Pin
MsmVc8-Dec-08 21:10
MsmVc8-Dec-08 21:10 
QuestionRe: How to write string values in .csv file Pin
Rajesh R Subramanian8-Dec-08 21:01
professionalRajesh R Subramanian8-Dec-08 21:01 
QuestionWindows Installer for a C++/MFC application Pin
Puneet Kulkarni8-Dec-08 19:46
Puneet Kulkarni8-Dec-08 19:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.