Click here to Skip to main content
15,913,773 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: File I/O Pin
2bee 20-Mar-06 22:17
2bee 20-Mar-06 22:17 
AnswerRe: File I/O Pin
RichardS19-Mar-06 23:10
RichardS19-Mar-06 23:10 
AnswerRe: File I/O Pin
2bee 19-Mar-06 23:21
2bee 19-Mar-06 23:21 
GeneralRe: File I/O Pin
Kuroro Rucilful20-Mar-06 14:48
Kuroro Rucilful20-Mar-06 14:48 
GeneralRe: File I/O Pin
Kuroro Rucilful20-Mar-06 14:50
Kuroro Rucilful20-Mar-06 14:50 
QuestionHelp With Change Pin
klutez12319-Mar-06 11:06
klutez12319-Mar-06 11:06 
AnswerRe: Help With Change Pin
Douglas Dean24-Mar-06 4:27
Douglas Dean24-Mar-06 4:27 
Questionmemcpy() and Structs in MC++ Pin
ScottLeff18-Mar-06 21:42
ScottLeff18-Mar-06 21:42 
[memcpy() and Structs in MC++]

Ok, I have a problem (obviously).
For years now I have been writing realtime network code to send and receive data
as such:

<br />
struct Header<br />
{<br />
   unsigned short size;<br />
   unsigned short rangeID;<br />
   unsigned short format;<br />
   unsigned short numItems;<br />
   char[] rangeName;<br />
   ...<br />
};<br />
struct TSPIFormat<br />
{<br />
   unsigned short int InstRefID;<br />
   unsigned short int InstID;<br />
   unsigned short int InstType;<br />
   double xVel;<br />
   double yVel;<br />
   double zVel;<br />
   ...<br />
};<br />
<br />
char buffer[1500];<br />
Header* TSPIHeader;<br />
TSPIFormat* TSPIData;<br />
//Filling it as such<br />
TSPIHeader->RangeID = 1;<br />
TSPIHeader->format = 1;<br />
...<br />
TSPIdata = m_TrackList[i];<br />
...<br />
//Packing and passing it off as such<br />
memcpy(&buffer[0],TSPIHeader,sizeof(Header));<br />
memcpy(&buffer[sizeof(Header)],TSPIData,sizeof(TSPIFormat));<br />
serverOut->SendTo(buffer,sizeof(Header)+sizeof(TSPIFormat),m_Port,m_IPAddress);<br />


And receiving it in the reverse manner.
Now that I'm trying to learn MC++ (ver 1.0, I havent delved into 2.0 yet) I'm having
trouble replicating this behavior in MC++.

I realize there isnt any sizeof() in MC++ and I think I understand the reasons why. But
the managed structs I create do not have a related size (because of the unknowns such
as the char array) so that I can pass off the different struct sizes to the memcpy().
I'm assuming there are other ways to Cast the structs into the char buffer such as marshalling
or streams, but I havent found concrete enough (for me) descriptions as to how these
structures would work in my situation.

If anyone can be of any help it would be greatly appreciated.
Thanks,
Scott
AnswerRe: memcpy() and Structs in MC++ Pin
2bee 30-Mar-06 19:56
2bee 30-Mar-06 19:56 
QuestionBest Practice for Unmanaged C++ Callbacks to C# Pin
Halloko17-Mar-06 22:14
Halloko17-Mar-06 22:14 
Questionfor each Pin
John L. DeVito17-Mar-06 11:21
professionalJohn L. DeVito17-Mar-06 11:21 
AnswerRe: for each Pin
George L. Jackson17-Mar-06 11:43
George L. Jackson17-Mar-06 11:43 
GeneralRe: for each Pin
John L. DeVito21-Mar-06 6:39
professionalJohn L. DeVito21-Mar-06 6:39 
GeneralRe: for each Pin
George L. Jackson21-Mar-06 11:49
George L. Jackson21-Mar-06 11:49 
QuestionRetrieving the CheckBox status from another application Pin
Virtek17-Mar-06 7:25
Virtek17-Mar-06 7:25 
AnswerRe: Retrieving the CheckBox status from another application Pin
Karim Mribti17-Mar-06 7:47
Karim Mribti17-Mar-06 7:47 
QuestionDifference Pin
HakunaMatada17-Mar-06 0:34
HakunaMatada17-Mar-06 0:34 
AnswerRe: Difference Pin
2bee 17-Mar-06 1:22
2bee 17-Mar-06 1:22 
QuestionAbstract class Object Creation Pin
Ramu Marriboina16-Mar-06 22:10
Ramu Marriboina16-Mar-06 22:10 
AnswerRe: Abstract class Object Creation Pin
2bee 16-Mar-06 23:07
2bee 16-Mar-06 23:07 
AnswerRe: Abstract class Object Creation Pin
toxcct17-Mar-06 0:30
toxcct17-Mar-06 0:30 
QuestionRetrieve unmanaged pointer from C++/CLI lib Pin
Jared McIntyre16-Mar-06 11:49
Jared McIntyre16-Mar-06 11:49 
AnswerRe: Retrieve unmanaged pointer from C++/CLI lib Pin
George L. Jackson16-Mar-06 14:56
George L. Jackson16-Mar-06 14:56 
AnswerRe: Parallel Port Programming Question Pin
George L. Jackson15-Mar-06 10:50
George L. Jackson15-Mar-06 10:50 
QuestionType check wont work properly Pin
Polity4h15-Mar-06 10:48
Polity4h15-Mar-06 10:48 

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.