Click here to Skip to main content
15,909,896 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Passing filename from C++ to Fortran Pin
Luc Pattyn9-Dec-08 5:29
sitebuilderLuc Pattyn9-Dec-08 5:29 
GeneralRe: Passing filename from C++ to Fortran Pin
Garth J Lancaster9-Dec-08 14:09
professionalGarth J Lancaster9-Dec-08 14:09 
GeneralRe: Passing filename from C++ to Fortran Pin
Luc Pattyn9-Dec-08 22:27
sitebuilderLuc Pattyn9-Dec-08 22:27 
GeneralRe: Passing filename from C++ to Fortran Pin
RedSonja9-Dec-08 20:52
RedSonja9-Dec-08 20:52 
AnswerRe: Passing filename from C++ to Fortran Pin
cp98769-Dec-08 15:03
cp98769-Dec-08 15:03 
GeneralRe: Passing filename from C++ to Fortran Pin
RedSonja9-Dec-08 20:46
RedSonja9-Dec-08 20:46 
GeneralRe: Passing filename from C++ to Fortran Pin
cp98769-Dec-08 21:03
cp98769-Dec-08 21:03 
GeneralRe: Passing filename from C++ to Fortran Pin
RedSonja9-Dec-08 21:53
RedSonja9-Dec-08 21:53 
GeneralRe: Passing filename from C++ to Fortran Pin
cp98769-Dec-08 22:50
cp98769-Dec-08 22:50 
GeneralRe: Passing filename from C++ to Fortran Pin
Luc Pattyn9-Dec-08 22:25
sitebuilderLuc Pattyn9-Dec-08 22:25 
AnswerRe: Passing filename from C++ to Fortran Pin
RedSonja11-Dec-08 20:13
RedSonja11-Dec-08 20:13 
QuestionWinInet Multithread Problems [modified] Pin
Julian Popov8-Dec-08 22:38
Julian Popov8-Dec-08 22:38 
QuestionIs it possible to have an array of types ? Pin
Defenestration8-Dec-08 22:20
Defenestration8-Dec-08 22:20 
AnswerRe: Is it possible to have an array of types ? Pin
Code-o-mat8-Dec-08 23:38
Code-o-mat8-Dec-08 23:38 
AnswerRe: Is it possible to have an array of types ? Pin
Defenestration8-Dec-08 23:43
Defenestration8-Dec-08 23:43 
GeneralRe: Is it possible to have an array of types ? Pin
Code-o-mat9-Dec-08 0:01
Code-o-mat9-Dec-08 0:01 
AnswerRe: Is it possible to have an array of types ? Pin
Defenestration9-Dec-08 0:12
Defenestration9-Dec-08 0:12 
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

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.