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

Managed C++/CLI

 
AnswerRe: String to Int? Pin
David Stone31-May-03 6:24
sitebuilderDavid Stone31-May-03 6:24 
QuestionHow to expose an [out] parameter in a Managed C++ class library? Pin
ralfoide29-May-03 17:51
ralfoide29-May-03 17:51 
AnswerRe: How to expose an [out] parameter in a Managed C++ class library? Pin
Nick Parker29-May-03 18:43
protectorNick Parker29-May-03 18:43 
GeneralRe: How to expose an [out] parameter in a Managed C++ class library? Pin
ralfoide29-May-03 19:22
ralfoide29-May-03 19:22 
GeneralRe: How to expose an [out] parameter in a Managed C++ class library? Pin
Nick Parker30-May-03 3:45
protectorNick Parker30-May-03 3:45 
GeneralRe: How to expose an [out] parameter in a Managed C++ class library? Pin
Paul Ingles2-Jun-03 23:26
Paul Ingles2-Jun-03 23:26 
AnswerRe: How to expose an [out] parameter in a Managed C++ class library? Pin
Nemanja Trifunovic4-Jun-03 5:32
Nemanja Trifunovic4-Jun-03 5:32 
GeneralHelp - File IO and arrays in managed C++.... Pin
markmalin29-May-03 11:55
markmalin29-May-03 11:55 
I'm trying to use managed C++ - I know this is the wrong forum but I get no response in the C++ forum.

I'm trying to use old C style structures to read in structured blocks of data from a file and am having no luck. For instance, here's my structure:

[StructLayout(LayoutKind::Explicit)]
__value struct PRE_HEADER
{
public:
[FieldOffset(0)]Byte fileType;
[FieldOffset(1)]UInt32 timeStamp;
[FieldOffset(5)]Int16 numIndexes;
[FieldOffset(7)]Byte padding;
};

Is there some way to read this in, maybe with streams like so:

PRE_HEADER ph;
int blocksize = sizeof(ph);
Byte tmpBuf __gc[] = new Byte __gc[blocksize];
FileStream* fs = File::Open(blah, blah, blah...);
fs->Read(tmpBuf, 0, blocksize);

And then somehow cast "tmpBuf" to be a PRE_HEADER type so I can access the members like you used to be able to do in C/C++??? These managed streams need to have a managed Byte buffer. I tried doing the following:

ph = reinterpret_cast<pre_header>(tmpBuf);

but the compiler isn't happy. I've tried different ways to create the variable "ph" on the managed heap, but because I have a "struc" there's no "new" operator, which I think is causing the unresolved external link errors looking for operator new().

There MUST be some way to do this. It's all so easy with C++ streams. You just make a buffer and pass it to the Stream::Read() function and cast it as your data type and away you go.

Thanks for any help - I"m pulling my hair out with this...Confused | :confused:
Mark.
GeneralRe: Help - File IO and arrays in managed C++.... Pin
Nick Parker29-May-03 18:55
protectorNick Parker29-May-03 18:55 
GeneralRe: Help - File IO and arrays in managed C++.... Pin
markmalin30-May-03 3:38
markmalin30-May-03 3:38 
General[Message Deleted] Pin
VladTheImpaler29-May-03 10:04
VladTheImpaler29-May-03 10:04 
GeneralRe: Managed C++ and Garbage Collection Pin
Kannan Kalyanaraman3-Jun-03 23:22
Kannan Kalyanaraman3-Jun-03 23:22 
GeneralAdd Web Reference Failed Pin
MacroPan27-May-03 18:09
MacroPan27-May-03 18:09 
QuestionFinal Project ideas? Pin
syntax28uk26-May-03 9:21
syntax28uk26-May-03 9:21 
General&quot;switch &quot;statement and mfc Pin
shanila25-May-03 16:41
shanila25-May-03 16:41 
GeneralIs it possible to simulate friend functionality in Managed Extensions in C++ Pin
csr7223-May-03 8:20
csr7223-May-03 8:20 
GeneralSolution Pin
csr7223-May-03 9:48
csr7223-May-03 9:48 
GeneralRe: Solution Pin
leppie26-May-03 7:18
leppie26-May-03 7:18 
GeneralRegistry Write and Read Pin
Leandro H. Delamare19-May-03 4:54
Leandro H. Delamare19-May-03 4:54 
GeneralRe: Registry Write and Read Pin
Nick Parker25-May-03 3:41
protectorNick Parker25-May-03 3:41 
Questionbrowse remote directory? Pin
chaiyan13-May-03 17:22
chaiyan13-May-03 17:22 
AnswerRe: browse remote directory? Pin
Paul Selormey14-May-03 15:19
Paul Selormey14-May-03 15:19 
AnswerRe: browse remote directory? Pin
Anonymous7-Jun-03 0:14
Anonymous7-Jun-03 0:14 
Question(Unmanaged classes) in managed C++ Form application? Pin
super12-May-03 0:28
professionalsuper12-May-03 0:28 
AnswerRe: (Unmanaged classes) in managed C++ Form application? Pin
Fazlul Kabir12-May-03 4:08
Fazlul Kabir12-May-03 4:08 

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.