|
This is a forum for "managed" C++ questions. Your posts do not appear to be about managed C++ issues. You should use the "Visual C++ / MFC" forum. It is the closest thing to a plain C++ forum that we have.
It appears you are a student in a CIS course. Make sure your read the material provided as many times as it may take to understand it. This is the essence of the problem you face.
|
|
|
|
|
how would i know if a series of binary number is negative?????
|
|
|
|
|
cOOLcOmbo wrote: how would i know if a series of binary number is negative?????
When is a number not a binary number?
|
|
|
|
|
and how do you define negative on those "binary number"s?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
//this code (c++)
int x=0, y=1, z=2;
printf("%d\n", --x&&--y||--z);
printf("%d, %d, %d\n", x, y, z);
//produces an output of
// 1
// -1, 0, 1
//which is logicaly correct
//then i changed it into
int x=0, y=1, z=2;
printf("%d\n", -- |--y&&--z); //<--------- here!!!
printf("%d, %d, %d\n", x, y, z);
//produces an output of
// 1
// -1, 1, 2
//WHY????????????
|
|
|
|
|
Since you have the OR (||) once a true ccondition is found the rest is not evaluated. So when --x is calculated to be -1 it is no zero and a true condition so the right side of the or does not need to be done.
|
|
|
|
|
Hello,
I create a "MFC application" project in MSVC 2005.
But I want to add a class ref from tThread.
For example,
public ref class tThread
{
public:
XXXXXXXXXXXXX
};
I add this code in the Form1.h.
But it has a default class From1.
I create a new header file to include.
#include "mythread.h"
But it come some errors.
This is mythread.h
///////////////////////////
#ifndef MYTHREAD_H
#define MYTHREAD_H
public ref class tThread
{
public:
static void Threadsend();
}
#endif
/////////////////////////////
This is mythread.cpp
#include "mythread"
using namespace System::Threading;
static void Threadsend(){
Thread::Sleep( 0 );
}
What's wrong with my code or are there better method to do it?
Appreciate your reply.
Thank you.
Jane
|
|
|
|
|
Please post on the correct form, you are much more likely to get an answer.
|
|
|
|
|
I move the code in mythread.cpp to mythread.h.
Then it works.
I think I had the problem before just because I dont understand
how to create my own header file completely.
-- modified at 6:43 Thursday 25th October, 2007
|
|
|
|
|
Hi all,
I tried the follwing connection string to connect with my local sql server "mySQLConnection = new SqlConnection(S"server=.;Trusted_Connection=yes;database=pubs;");" , it works well for me,now i am trying to connect with an sql server database presented in an remote system, also how to mention the username and password of the data base to communicate. Can any one suggest me some samples/links where can i get idea's
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
|
Thousands of thanks for you help. It really help me not only for sql, for all database. Thank you once again
Know is Drop, Unknown is Ocean
|
|
|
|
|
You are welcome
|
|
|
|
|
|
I have an global function and I want to send a message to the actual window. With unmanaged C++ I did it with PostMessage(::GetActivWindow,....) and in the active window I catched the messae with ON_MESSAGE(...).
But how can I do this in managed C++ and Windows Forms?
|
|
|
|
|
How can I make a System Beep with managed C++?
|
|
|
|
|
|
Hello,
I am confused about the type of vc++ .NET.
I want to use the string typed in the Textbox.
The property "Text" of Textbox has the type "string^".
I want to change it to char*.
I use the TextBox->Text->ToCharArray, but it is not char* type.
It is wchar_t type.
How could I convert the string^ type to char*?
Appreciate your reply.
Thank you.
Jane
|
|
|
|
|
minihotto wrote: I am confused
What material did you study to learn the issues related to mixed mode development? If you just launched Visual Studio and started coding then that's why you are confused. There are articles here on Code Project[^] and on MSDN that introduce managed/native issues to developers. I strongly suggest your read them.
If you have read some and are still confused you should reference the article and the section that you are confused about.
|
|
|
|
|
Hello,
I am new to C++, coming from C.
I am using this 'static_cast<int>' and just wondering what it is used for and when is the best time to use it.
Many thanks,
Steve
-- modified at 23:32 Wednesday 17th October, 2007
|
|
|
|
|
There are four templated cast operators in C++, although most people still use C style casts. You should read up on all four, there's plenty of articles on the web.
You should ask your questions in the Visual C++ forum, this one is for .NET based C++.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
We have four operators static_cast ,dynamic_cast,const_cast and reinterpret_cast, on the c++ But when you must use of them I suggest see some articles about Type Casting.
|
|
|
|
|
Hi, I'm using Visual Studio 2005 C++/CLI. Can this even be done? I have properties that I need to setup. I have a Form that has a tabControl on it. The tabControl contains ten tabPages (one page for each defined test). Each tabPage has another tabControl placed on it with one tabPage per instrument. Here's the deal. Every test uses an instrument that has 20 definable properties. So if I select the tabPage for Test1 I will see sub-tabPages for Instrument1, Instrument2, etc. Now I can place 20 comboBoxes on tabPageTest1.Instrument1 and then do the same for tabPageTest2.Instrument1, tabPageTest3.Instrument1, etc., but then I end up with 200 comboBoxes, each with a unique name (that I have to take the time to rename) like comboBoxAcqModeTest1, comboBoxAcqModeTest2, comboBoxAcqModeTest3, etc. What I would like to do is use the tabPage for Instrument1 as (for lack of a better term) a template that I can populate with the information for a given test and then display under the correct tab. What I have tried is when I click tabPageTest10, I populate tabPageTest1.Instrument1 and then tried BringToFront() but that didn't work. Is there a way to either bring the tabControl inside tabPageTest1 to the top of the display or copy the tabControl from tabPageTest1 to tabPageTest10?
Thanks
Buck
|
|
|
|
|
BuckBrown wrote: but then I end up with 200 comboBoxes
Sounds like a Bug Splat UI to me. Ever heard of TreeView, ListView and PropertyGrid?
|
|
|
|
|
Hello,
this question may come from a very wrong approach , feel free to suggest a better way to solve this
I want to store a global dynamic list of structs inside a managed code dll.
First I create the array list
gcroot<System::Collections::ArrayList*> parameters;
parameters=new System::Collections::ArrayList();
But i get a very weired exception during runtime:
Handle has not been initialized when creating the ArrayList.
How can I initialize this variable the correct way?
Thx for your time..
|
|
|
|