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

Managed C++/CLI

 
GeneralRe: Ambiguous Error Pin
Anonymous26-Oct-04 8:59
Anonymous26-Oct-04 8:59 
GeneralRe: Ambiguous Error Pin
Christian Graus27-Oct-04 9:09
protectorChristian Graus27-Oct-04 9:09 
GeneralRe: Ambiguous Error Pin
George L. Jackson27-Oct-04 9:16
George L. Jackson27-Oct-04 9:16 
Generalunmanaged to managed code conversion Pin
Member 138330524-Oct-04 23:56
Member 138330524-Oct-04 23:56 
GeneralRe: unmanaged to managed code conversion Pin
BlackDice27-Oct-04 7:51
BlackDice27-Oct-04 7:51 
Generaldependancies problem Pin
Mostafa Mohamed23-Oct-04 9:17
Mostafa Mohamed23-Oct-04 9:17 
GeneralRe: dependancies problem Pin
Anonymous2-Nov-04 19:19
Anonymous2-Nov-04 19:19 
GeneralReturning Strings in an arguement list Pin
nickOppen22-Oct-04 16:47
nickOppen22-Oct-04 16:47 
I'm trying to manipulate a string in a function and return the result in two subsequent arguements in the same call. Here is one version I've tried using de-referenced pointers.

In MFC I passed the 2nd and 3rd arguements in as references to the original CStrings and that worked fine.

The same approach does not work and regardless of how I do it, verb and arg in the calling function (decodeLine(..)) remain unchanged.



UInt32 verbArguement(String * line, String ** pVerb, String ** pArg)
{ // splits verb(args) into verb and (args)
int bracketPos;
String * verb = *pVerb;
String * arg = *pArg;

// pull off the word preceeding the (
bracketPos = line->IndexOf('(', 0);
if (bracketPos >= 0)
{
verb = line->Substring(0,bracketPos);
arg = line->Substring(bracketPos); // here verb == "hint" and arg == "(2,P)"
return 1;
}
else
{
fileReaderException * e = new fileReaderException(fileReaderException::ERR_NON_FILE);
throw e;
}
return 0;
}





// strLine == S"hint(2,P)"

Int32 decodeLine(String * strLine)
{
String * verb;
String * arg;

if (verbArguement(strLine, &verb, &arg))
{
// at this point verb == null and arg == null
}
}

It seems that Microsoft has done a cheap and dirty on the implementation of String, effectively making all methods constructors and letting the garbage collector clean up the mess. That is why the pass by reference approach did not work. It also seems that the semantics of pointers and de-referencing has also changed. I'm pretty sure that the above code would work in standard C++.

Does anyone have a solution?
Questionwhat si #pragma once? Pin
Mario_Young22-Oct-04 13:01
Mario_Young22-Oct-04 13:01 
AnswerRe: what si #pragma once? Pin
Christian Graus25-Oct-04 12:50
protectorChristian Graus25-Oct-04 12:50 
GeneralRe: what si #pragma once? Pin
BlackDice27-Oct-04 7:54
BlackDice27-Oct-04 7:54 
Generalparser Pin
Anonymous21-Oct-04 9:18
Anonymous21-Oct-04 9:18 
GeneralOperator Overloading Problem Pin
Anonymous20-Oct-04 12:26
Anonymous20-Oct-04 12:26 
GeneralRe: Operator Overloading Problem Pin
Christian Graus21-Oct-04 16:26
protectorChristian Graus21-Oct-04 16:26 
GeneralString to wchar_t conversion Pin
Murlai18-Oct-04 21:17
Murlai18-Oct-04 21:17 
GeneralRe: String to wchar_t conversion Pin
Mr Mayur K20-Oct-04 5:07
Mr Mayur K20-Oct-04 5:07 
GeneralString conversions Pin
Murlai18-Oct-04 19:51
Murlai18-Oct-04 19:51 
GeneralRe: String conversions Pin
George L. Jackson19-Oct-04 15:40
George L. Jackson19-Oct-04 15:40 
GeneralRe: String conversions Pin
AnsGe20-Oct-04 17:51
AnsGe20-Oct-04 17:51 
Generaliteration through map Pin
aspen_matthews18-Oct-04 19:44
aspen_matthews18-Oct-04 19:44 
GeneralRe: iteration through map Pin
Christian Graus19-Oct-04 9:28
protectorChristian Graus19-Oct-04 9:28 
GeneralRe: iteration through map Pin
aspen_matthews19-Oct-04 14:29
aspen_matthews19-Oct-04 14:29 
GeneralRe: iteration through map Pin
Christian Graus19-Oct-04 14:33
protectorChristian Graus19-Oct-04 14:33 
GeneralRe: iteration through map Pin
Mr Mayur K20-Oct-04 5:09
Mr Mayur K20-Oct-04 5:09 
GeneralRe: iteration through map Pin
aspen_matthews20-Oct-04 9:58
aspen_matthews20-Oct-04 9:58 

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.