|
First of all, please remember the debugging 101:
1. Attach a debugger and try to run it then.
2. The debugger will stop at the Null Pointer assignement, and you can fix the error.
About Null pointer assignments:
Null pointer assignments occur when you try to access a pointer which's memory was deleted or not initialized (via malloc or new) and are a strong hint towards dangling and insecure pointers.
People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.
|
|
|
|
|
how can I draw real-time curve in coordinate system? The development compiler of mine is qt!thank you!
|
|
|
|
|
|
thank you ,but i can't find a good example for my application 
|
|
|
|
|
The first link is a Youtube video that shows how.
Veni, vidi, abiit domum
|
|
|
|
|
thank you for your tips ,but those can't solve the problem of real-time performance in my application!
|
|
|
|
|
What do you mean by "real-time performance"? If you expect that in Windows you are going to be disappointed. And drawing lines in Windows is exactly the same wherever the data comes from.
Veni, vidi, abiit domum
|
|
|
|
|
|
http://qt-project.org/forums/viewthread/14819[^]
People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.
|
|
|
|
|
thank you ,your advances would be good for me!
|
|
|
|
|
Hello!
I had an error in my project created with QT and C++
I created Server which gets data from AudioInput and gives it to UDP Socket, there is no problem, but in Client's project I had a problem, when I tried to write data to AudioOutput device after UDP Socket gets this data from net
in my project error was in this line "int l = audioSource->read(audioBuffer,input);" in
"qaudiooutput_win32_p.cpp"
and this is Call Stack at time debugging which shows this
QtMultimediad4.dll!QAudioOutputPrivate::deviceReady() Line 579 + 0x1c bytes C++
QtMultimediad4.dll!QAudioOutputPrivate::qt_static_metacall(QObject * _o=0x00b53308, QMetaObject::Call _c=InvokeMetaMethod, int _id=1, void * * _a=0x00b51d20) Line 52 + 0x8 bytes C++
what I did wrong
PLEASE HELP!!!!! 
|
|
|
|
|
|
Could be that the audio device is being locked up by the other caller. You don't show the actual error code but the function where it stalls out would indicate that he's checking if the device is ready.
You should post the actual error output instead of the call stack. Also, this is likely a problem with how you're using Qt, so you may be better off asking for help in a Qt forum.
|
|
|
|
|
Could anyone please help me to find why call to sort() is crashing at run-time in following code block:
string s = "Annnitttesrrh.";
vector<char> vecChar(s.begin(), s.end());
sort(vecChar.begin(), vecChar.end(), greater_equal<char>());
Am i missing something very basic ?
|
|
|
|
|
Kumar Anitesh wrote: Am i missing something very basic ? Not that I can figure out. I tried the same code, but using greater as the predicate and it works fine. This needs an STL expert to look at it, but you posted in the managed C++ forum; try http://www.codeproject.com/Forums/4486/ATL-WTL-STL.aspx[^].
Veni, vidi, abiit domum
|
|
|
|
|
Hello,
I'm a bit confused about the difference between:
LRESULT CALLBACK WndProc(HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam);
and
virtual void WndProc(Message %m);
I know that the first is to get message to menage event in win32, but so "WndProc(Message %m)" is the same thing when we are programming a Windows Form project?
The last question is: when is better to use NativeWindow methos and when is better to use win32 methods to menage events?
My project is a simple window form with a panel, on the Panel i call a window where I can menage OpenGL operations.
Could someone help me?
Thank you
|
|
|
|
|
The first version is the native unmanaged code version, and the second is the managed one[^]. As to which is better, that depends on the design and structure of your program.
Veni, vidi, abiit domum
|
|
|
|
|
Use a native window when you're working with native C/C++/WinAPI code and use the managed version when you're using managed code. Only reason to use native code when you have a managed project is if the managed version doesn't do something you need already (which is hardly ever the case).
|
|
|
|
|
Ok I need some help here. I have been through the MSDN sites and tried multiple types of sockets and streams.
What I am trying to do is this. I have a C++/CLI forms app using /clrsafe runtime.
What I need is socket so I can send a string like "^0!NO\r" through a raw TCP port. There is only a "one way connection here" the response will have to be on a listener stream but the system will not be making a socket connection with the program. I have completed this in Python script so those who know python this is how I did it.
Chost = '169.254.232.50'
Cport = 1555
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket Created'
cam = socket.socket()
try:
s.bind((host, port))
except socket.error , msg:
print 'Bind failed. Error Code : ' +str(msg[0]) + ' Message ' + msg[1]
sys.exit()
Any help would be great,
|
|
|
|
|
The code is much the same as you have above, although you would use connect rather than bind ; see this tutorial[^].
Veni, vidi, abiit domum
|
|
|
|
|
Hi, I actually have 2 problems. If i enter gcgc, it should give me 4 when counting G's and C's but it gives me 3 instead. Also, the program doesn't stop by itself (I have to press control C to get out). What is wrong with my code?
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
char input = ' ';
int count = 0;
char newinput = ' ';
int newcount = 0;
cout << "Enter the DNA strand:";
cin >> input;
while (input != '\n')
{cin.get(input);
switch (toupper(input))
{
case 'C':
count++;
break;
case 'G':
count++;
break;}}
cout << "There are " << count << " C's and G's in this DNA strand."<< endl;
while (input != '\n')
{cin.get(input);
switch (toupper(input))
{
case 'B':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin>>newinput;
cin.clear();
cin.ignore('\n');
break;
case 'D':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'E':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'F':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'H':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'I':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'J':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'K':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'L':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'M':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'N':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'O':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'P':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'Q':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'R':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'S':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'U':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'V':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'W':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'X':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'Y':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'Z':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
}
}
while (newinput != '\n')
{ cin.get(newinput);
switch (toupper(newinput))
{ case 'C':
newcount++;
break;
case 'G':
newcount++;
break;
}
}
cout << "There are " << newcount << " C's and G's in this DNA strand." << endl;
return 0;
}
|
|
|
|
|
You could simplify this by removing all those redundant case blocks and replaing them with a single default: . You could then use your debugger to find out why it does not break out of the loop.
Use the best guess
|
|
|
|
|
I have a native dll with some code that I want to leverage from managed C# applications.
So I wrote a C++/CLI class library to implement an wrapper assembly.
This works well but it creates a maintenance issue.
In the C# client project, I added a reference to my wrapper assembly and whenever I build the client project, the assembly dll gets copied to the build target folder.
However the dependent native dll does not get copied.
So my question is, how do I include the native dll in the wrapper assembly dependency so that they are both copied when the client project is built.
|
|
|
|
|
AFAIK, you don't. What you could do is have a post-build step which copies the files over.
|
|
|
|
|
I'll second this. We have a post-build step copy the DLLs too.
John
|
|
|
|