Jump to content
  • Advertisement
Sign in to follow this  
pascalosti

CLR anyone?

This topic is 4319 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have to relearn c++ in clr anyone know a good reference (other then msdn) or help me out below. The final project i have to convert some metric units to the messed up stuff. I just need to know how to read and print number and string (the convert from string to int throws me). and if calling a function is different. #include "stdafx.h" #include <string> using namespace System; int main(array<System::String ^> ^args) { string word; float somenumber; Console::WriteLine(L"Welcome"); Console::ReadLine(word); return 0; }

Share this post


Link to post
Share on other sites
Advertisement
whoa what the hell is clr?
Whats the ^ symbol doing here? "array<System::String ^> ^args"
Whats the L doing here?? "Console::WriteLine(L"Welcome");"

Thats not C++ more liek C+/-

Share this post


Link to post
Share on other sites
He's probably talking about C++/CLI.

Have a look here to start with: http://msdn.microsoft.com/msdnmag/issues/06/00/PureC/default.aspx

Share this post


Link to post
Share on other sites
Quote:
Original post by PhilMorton
Whats the L doing here?? "Console::WriteLine(L"Welcome");"
The L prefix is used to create a Unicode string literal. It's actually valid in both C++ and C++/CLI.

Share this post


Link to post
Share on other sites
im pretty sure its clr

new -> project -> visualc++ clr -> clr console application

console::Writeline
and
console::Readline

doesnt work in win32 console application
or general console

Share this post


Link to post
Share on other sites
CLR is the Common Language Runtime. I haven't messed with it as of yet, but it seems to be a major part of the newer functions and data types for higher security in applications. It's covered pretty extensively in the MS PSDK.

Although the need for better security has raised it's ugly head for MS all too often, I sometimes start wondering if they just want to see how incredibly confusing they can make it to code "their way".

Share this post


Link to post
Share on other sites
CLR is the Common Language Runtime. It's basically the .NET runtime and allows multiple languages do be used in one project. Now I program in C#, not C++, but from what I recall ^ is basically just like * (meaning it's a pointer), except it points to stuff in the managed space. And the L seems to be equivalent to C#'s @, which causes the string to be interpreted literally instead of taking escape characters into account.

Share this post


Link to post
Share on other sites
Quote:
Original post by PhilMorton
whoa what the hell is clr?
Whats the ^ symbol doing here? "array<System::String ^> ^args"
Whats the L doing here?? "Console::WriteLine(L"Welcome");"

Thats not C++ more liek C+/-

You're half right. It isn't C++ at all. Good eye, I'll bet you get lots of gold stars at school.

OP: You are targetting the CLR, but you are actually programming in C++/CLI. Don't worry too much about the distinction. yaroslavd is right about the ^, and promit is right about the L, in case either of those are confusing you as well.

You mention that string conversions are throwing you off, but your code doesn't actually have any. Do you have any thoughts as to how to proceed? Perhaps some code that doesn't work like you'd expect?

CM

Share this post


Link to post
Share on other sites
C++/CLI aka Managed C++ isn't portable. Taking that into consideration, if you want to create cross-platform solutions, it would be better to use either straight C++ or C# and Mono.

Share this post


Link to post
Share on other sites
Quote:
Original post by Rob Loach
C++/CLI aka Managed C++ isn't portable. Taking that into consideration, if you want to create cross-platform solutions, it would be better to use either straight C++ or C# and Mono.


C++/CLI and Managed C++ are not the samething, C++/CLI is ECMA standardized (soon to be joint ISO standardized) language & language binding for standard C++ to .NET. Infact there is a implementation of the C++/CLI standard for mono/gcc in the works.

Managed C++ is an older, inferior predessessor to C++/CLI which was exclusively to VC++ 2k3 .NET.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!