|
In a very long loop (up to 500.000), I have a String^ variable that takes long lengths (and different values) each loop cycle. I wonder if it's worthy to delete the variable at each loop cycle's end; if delete is not used, will the CLR take care of it ?
|
|
|
|
|
String is not IDisposable, so there's no point in calling delete. For another thing, you don't need to do that anyway, the GC will appropriately come into play as and when required.
Regards,
Nish
Fly on your way like an eagle
Fly as high as the sun
On your wings like an eagle
Fly and touch the sun
|
|
|
|
|
Thanks Nish. ![Cool | :cool:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_cool.gif)
|
|
|
|
|
if you are able to write this program please help me:
YOU KNOW THAT THE ISDN NUMBER IS A SPECIFIC NUMBER FOR EACH BOOK,AND FOR EXAMPLE AN ISDN NUMBER LIKE 964-92032-1-4 CONTAINS THIS INFORMATION:
ISDN : TheLanguageOfTheBook-PublisherCode-BookNumber-CheckDigit
the check digit number is calculated in this way,
for example for 964-92032-1-4 :
10x9 + 9x6 + 8x4 + 7x9 + 6x2 + 5x0 + 4x3 + 3x2 + 2x1 = 271
271%11=7 = Result
then the CheckDigit number should be (11-Result)
ok?
Here's the interface of the program:
Enter ISBN: 964-92032-1-4
Language: 964
Publisher: 92032
Book number: 1
Check digit: 4
This ISBN code “964-92032-1-4” is valid!
or
This ISBN code “964-92032-1-4” is invalid!
Please let me know if you understood the program well!thanks again,sorry for the english mistakes found in my text,i'm really sorry!
Khodadad Pakdaman
Pakdaman@CleanMail.it
|
|
|
|
|
You have to first decide why you need to use C++/CLI to write this program. What would your goals be? For that matter, it would be a good idea to decide if you even want to use .NET for the application.
Regards,
Nish
Fly on your way like an eagle
Fly as high as the sun
On your wings like an eagle
Fly and touch the sun
|
|
|
|
|
That'a C++ 6 simple program,i don't want to use .net!ok?
please help me,i'm in need of that program,
thanks again!
|
|
|
|
|
Khodadad Pakdamans wrote: That'a C++ 6 simple program,i don't want to use .net!ok?
Then you are in the wrong forum. This forum is for C++/CLI questions.
Regards,
Nish
Fly on your way like an eagle
Fly as high as the sun
On your wings like an eagle
Fly and touch the sun
|
|
|
|
|
hi... this is my first post here.
can someone provide me with a sample of how to write an array of struct via named pipe?
i am new to named pipe. i have tried writing using the message type mode... however i have not tried using byte mode. moreover, i have an array of struct to write.
thanks in advance for any help!
newbie ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
This question should be posted on the Visual C++/MFC board since it doesn't seem to involve
managed C++.
In byte mode you need a pointer to the first struct you want to write. The number of bytes
to write is the sizeof the struct times the number of structs to write.
Which part is giving you trouble?
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Definitely a first post worthy of a 5 vote!
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
hi Mark... thanks and sorry for the wrong post...
can i just continue the thread here and not repost in vc++?
i have done a sample app of writing structs via named pipe... my trouble now is how to properly manage/convert the array of structs to LPVOID which is what i am passing to the named pipe functions (readfile/writefile)... and from LPVOID back to array of structs. or should i use a different data type and not lpvoid?
thanks again!
newbie ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
how to change screen resolution to 1024 X 768 in Turbo C++
|
|
|
|
|
First of all, C++ is a useful header for your question only because it gave me a clue that you were totally in the wrong place. 'Change screen resolution', would have been better. 'Change screen resolution in Turbo C++' would be better still, given that almost everyone on this site is using visual studio.
I doubt that Turbo C++ supports Microsoft .NET, which means that the C++/CLI forum is definately the wrong place to ask this question. Try the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: C++ is a useful header for your question only because it gave me a clue that you were totally in the wrong place
Christian Graus wrote: Turbo C++
Haven't worked with that in a long, long time. I know I still have it around here somewheres :->
|
|
|
|
|
You have to include windows.h header. Here is an working example.
#include <stdio.h>
#include <windows.h>
#include <winuser.h>
int main() {
DEVMODE devmode;
devmode.dmPelsWidth = 1024;
devmode.dmPelsHeight = 768;
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmSize = sizeof(DEVMODE);
long result = ChangeDisplaySettings(&devmode, 0);
return 0;
}
|
|
|
|
|
hai all
can any one help in unit test where i need to test the inheritance, static and dynamic polymorphism
senthil
|
|
|
|
|
Unit test is the wrong terminology. You don't want to test your code, you want to write code that demonstrates polymorphism.
You are also in the wrong forum, you don't need C++/CLI to do this, nor does C++/CLI add any features in this regard. You wanted the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all,
i want to add in that server program that it will accept only the password from the client if it's "mypassword":
i'm not writing any client program. the client will be the built in linux Telnet program
so the session will be between the server and client as follows
1. telnet 192.11.11.9 password "mypassword".
2.then the server if recieved the password "mypassword" it will connect if not it will close the connection.
I want to know how i can make the server program recognize that the pasword is right or wrong..how i can write it in the server
Thanks
|
|
|
|
|
Are you using .NET, or are you in the wrong forum ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
No...I'm unsing C programming
|
|
|
|
|
mhetfield1978 wrote: No...I'm unsing C programming
Then you are in the wrong forum. This one's for .NET based C++ questions.
|
|
|
|
|
Hello everyone... Im just starting a new project using C++/CLI. Can some one please tell me why
this code does not work?
std::string nativeStr = "Hello World";
String^ managedStr = nativeStr.c_str();
but this code does work
std::string nativeStr = "Hello World";
String^ s6 = gcnew String(nativeStr.c_str());
howevet i want to be able to create my managedStr on the stack, and would expect this to work..
Can anybody tell me where i am going wrong
|
|
|
|
|
flippydeflippydebop wrote: i want to be able to create my managedStr on the stack, and would expect this to work
Then you don't understand how the .NET Platform works. Try reading some introductory programming articles on MSDN[^] Actually there might even be some here on CodeProject if you care to look.
led mike
|
|
|
|
|
flippydeflippydebop wrote: howevet i want to be able to create my managedStr on the stack, and would expect this to work..
LedMike has the correct answer.
To add...creating a managed object on the stack is a redundant/silly concept. It's all about
scope here. Creating it the way you've shown in the working sample gives it the same scope
as a stack variable.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
well hang on then guys...
Why does this:
System::String^ myStr = "hello"
Work fine even though i do not use the gcnew operator to allocate the string 'myStr' on the heap?
What i am saying is that i know in the .net world everything is allocated on the heap and that the above statement, even though it appears to reside on the stack is probably being allocated on the heap..
Now if the compiler lets me write code like above, then why wont it let me write code like this:
String^ managedStr = nativeStr.c_str();
The above line fails.. Instead in this instance i have to explicitly allocate the variable managedStr on the heap like so:
String^ s6 = gcnew String(nativeStr.c_str()); // works!
|
|
|
|