|
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
|
|
|
|
|
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!
|
|
|
|
|
When you do this
System::String^ myStr = "hello" myStr gets a reference to a pointer that already exists in the app's (assembly's) user strings
metadata section.
When you do this
String^ managedStr = nativeStr.c_str(); a System::String constructor is required. To use the constructor the object needs to be created
on the managed heap.
I tracked down a better description than I could possibly give:
Scroll to the second question/answer here[^]
Hope that helps!
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Yes because "hello" is treated as the type (System.String) by the CLI compiler. Look at the MSIL code to see the difference. Also note that: System::String^ myStr = (const char*)"hello"; does not work.
See Stan Lipman's blog[^]
The insight to resolve this is to realize that the dual citizenship of a string literal applies to its fundamental type, not to its set of trivial conversions. In effect, under C++/CLI, the underlying type of a string literal such as "Pooh" is both const char[5] (its native inheritance) and System::String (its managed underlying unified type). Under C++/CLI, the string literal is an exact match to System::String and the trivial conversion to const char* is not considered. That is, under the revised C++/CLI language specification, the ambiguity has been resolved in favor of System::String
led mike
|
|
|
|
|
ahh-haaaa... i see (said the blind man). Well, guys it would seem i need to do some more reading of the subject material.
Thankyou both for taking the time to reply.
|
|
|
|
|
how to disable print screen using c++.i tried but i can't get answer.So please give if you know how to disable print screen using in windows operating system
srinivas
|
|
|
|
|
|
Hi guys
Can any one temme what does this mean
void AddtoNode(char*& Content, const char*& Buffer);
I am not getting this char*& part. Is it pointer to pointer or wt.
Thanks
|
|
|
|
|
I believe it is a "reference to a pointer."
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
but what does it mean....?
|
|
|
|