Click here to Skip to main content
16,005,181 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
QuestionWhat can I do? Pin
Jacky Tsee8-Oct-05 6:31
Jacky Tsee8-Oct-05 6:31 
QuestionRe: What can I do? Pin
Jacky Tsee8-Oct-05 6:33
Jacky Tsee8-Oct-05 6:33 
AnswerRe: What can I do? Pin
Nemanja Trifunovic8-Oct-05 7:44
Nemanja Trifunovic8-Oct-05 7:44 
GeneralRe: What can I do? Pin
Jacky Tsee8-Oct-05 18:37
Jacky Tsee8-Oct-05 18:37 
GeneralRe: What can I do? Pin
TheGreatAndPowerfulOz19-Oct-05 11:40
TheGreatAndPowerfulOz19-Oct-05 11:40 
Questioncastings Pin
Alex Cutovoi8-Oct-05 3:09
Alex Cutovoi8-Oct-05 3:09 
AnswerRe: castings Pin
Christian Graus8-Oct-05 3:51
protectorChristian Graus8-Oct-05 3:51 
AnswerRe: castings Pin
mikanu12-Oct-05 13:13
mikanu12-Oct-05 13:13 
You have to be a little more specific.

In case what you need to do is to convert the structure to a "seequence of char-type variables" which is called serialization of data-types (there's a ton of documentation about it out there) than your best bet is to simply use the C-style casting such as:

<code>
struct infoGame
{
time_h theTime;
bool bAcumVariavel;
float fValCred;
};

char *serializeStructure(struct infoGame inputStruct)
{
    return (char*)inputStruct;
}

void UnSerializeStructure(char* inputBuffer, struct infoGame* outputStruct)
{
    outputStruct* = (infoGame)inputBuffer;
}
</code>



Then you could use these functions to save the structure to a file for example and then to retrieve it from a file etc.

In case you were trying to display the members of the strucutre i.e. to a string to then use TextOut or printf than what you're looking for is sprintf. You can use it to print (and format) other data-types into a string which can later be printed on the screen or to a printer.

e.g

<code>
struct infoGame
{
time_h theTime;
bool bAcumVariavel;
float fValCred;
};

struct infoGame sIG;
char* myText;

myText = (char*)malloc(1024);  // make sure you allocate memory for the string

sprintf(myText, "Long Variable is = %d, Boolean Variable = %d, Float Variable = %f", sIG.theTime, sIG.bAcumVariavel, sIG.fValCred);

free(myText);  // free the resources allocated for the text
</code>




mikk

-- modified at 19:20 Wednesday 12th October, 2005
Questionconfiguration of windows update Pin
Girish6017-Oct-05 21:05
Girish6017-Oct-05 21:05 
AnswerRe: configuration of windows update Pin
Saksida Bojan7-Oct-05 22:42
Saksida Bojan7-Oct-05 22:42 
GeneralRe: configuration of windows update Pin
Girish6017-Oct-05 22:52
Girish6017-Oct-05 22:52 
GeneralRe: configuration of windows update Pin
Saksida Bojan8-Oct-05 2:40
Saksida Bojan8-Oct-05 2:40 
GeneralRe: configuration of windows update Pin
Girish6018-Oct-05 3:11
Girish6018-Oct-05 3:11 
GeneralRe: configuration of windows update Pin
Saksida Bojan12-Oct-05 19:49
Saksida Bojan12-Oct-05 19:49 
QuestionMFC v VC++.Net Pin
Klempie7-Oct-05 9:44
Klempie7-Oct-05 9:44 
AnswerRe: MFC v VC++.Net Pin
Christian Graus8-Oct-05 3:55
protectorChristian Graus8-Oct-05 3:55 
AnswerRe: MFC v VC++.Net Pin
Nemanja Trifunovic8-Oct-05 5:02
Nemanja Trifunovic8-Oct-05 5:02 
QuestionHow to signal an event from a managed event handler to an unmanaged callback in a different thread? Pin
mav.northwind7-Oct-05 0:16
mav.northwind7-Oct-05 0:16 
AnswerRe: How to signal an event from a managed event handler to an unmanaged callback in a different thread? Pin
mikanu10-Oct-05 5:45
mikanu10-Oct-05 5:45 
GeneralRe: How to signal an event from a managed event handler to an unmanaged callback in a different thread? Pin
mav.northwind10-Oct-05 7:51
mav.northwind10-Oct-05 7:51 
Questionconfiguration of windows update Pin
Anonymous7-Oct-05 0:13
Anonymous7-Oct-05 0:13 
AnswerRe: configuration of windows update Pin
Saksida Bojan7-Oct-05 22:39
Saksida Bojan7-Oct-05 22:39 
Questionhow to link .lib file to my project (managed C++) in .Net Pin
vic120006-Oct-05 18:34
vic120006-Oct-05 18:34 
AnswerRe: how to link .lib file to my project (managed C++) in .Net Pin
Anonymous6-Oct-05 21:37
Anonymous6-Oct-05 21:37 
GeneralRe: how to link .lib file to my project (managed C++) in .Net Pin
vic120007-Oct-05 9:00
vic120007-Oct-05 9:00 

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.