|
Thanks for the suggestions. After a little thought I decided to go with the std::vector method, because it is dynamic and will only take up the required amount of precious memory. I can always set a limit to the number of modes I want to read in, but at least the memory allocation will be efficient...
Thanks for the suggestion guys, very much appreciated.
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Hi all,
I have an MFC application that I is working in debug mode. However when I build it in Release mode, it appears to me that the global instance of my CWinApp derived class does not exist in the application. Therefore when the app goes to reference that object, it is referencing bad memory and the application crashes.
Does anybody know of a project setting, include file, or piece of code that would cause this problem, or does anyone at least know how to fix this?
Any insight would be greatly appreciated.
Thanks
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I think there is a bug in your application. It is declared like CMyApp the App; , so it exists regardless of the configuration. Could you please show some code when you reference that object?
Best regards,
Alexandru Savescu
|
|
|
|
|
You may be right about the problem being with my code. But I can get both debug and release builds to compile and start running.
The one main thing that confuses me is that the winApp object is present and gets initialized in debug mode, but it is like it never gets initialized or recognized in Release mode. So the first time that the winapp object is referenced it crashes.
If I trace to where MFC gets its pointer to the WinApp object (inside of the MFC source code), and I type the name of the Winapp variable in the watch window, it does not recognize the variable and thinks that it does not exist.
As far as posting some code what would you like to see? My instance of the CWinApp object is declared like this inside of my main cpp file:
CAMClientApp theApp;
It is declared like this in the matchin header file:
extern CAMClientApp theApp;
Thanks for your help, if you have any other ideas I would like to hear them.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Try to not declare it extern in the header file and use the AfxGetApp() function to refer it. If it still crashes, compile the realese with debug information and try some debugging.
Best regards,
Alexandru Savescu
|
|
|
|
|
I would like to let everyone know that I have narrowed it down to the optimizations setting in the project properties.
If I change the setting to anything but "default" or "disable", I get this weird problem. I allow function inlining and that seems to be ok.
After my deadline I will do customized optimizations and see if I can narrow it down to the optimization that is causing this problem.
In the meantime if anyone else has any ideas to what could cause this weird problem that I am seeing, I would really appreciate your feedback.
Thank you,
Paul
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
my problem is : I have an exe which has used SDK & is coded in c & c++.Now i have to give Doc/View Architecture support to the exe for implementing some functionality of MFC.
I tried to make a regular Dll (having Doc/View arch' & exporting a function to be used by exe) but it didnt work proprely
Can anyone suggest me the way to do the above
surbinsho
|
|
|
|
|
I was following Mauricio Ritter's intro, http://www.codeproject.com/directx/BasicDD.asp
when I realized that after I alt-tab'ed out of the program, I can no longer go back in. How should I modify the code so that I can reenter the program?
Thanks
|
|
|
|
|
I have the handle of the iexploerer window,now I want send a message to back or forward the page.
Any function or Message?
Best Regards!
|
|
|
|
|
how can u return the value of an unsigned char...example code:
----example code-------
typedef{unsigned char data[16]}data_out;
----end code-----------
|
|
|
|
|
I hate typedefs, and this one is totallystupid.
unsigned char c = *(&data_out + 2);
gets you the third element ( data[2] )
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
|
i guess server socket must be on NT Server platform and client socket can be on any platform (95/98/200/station etc.).
is the 'guess' right?
if i install more software, can i run them on different plateform?
thanks.
includeh10
|
|
|
|
|
No no, a server socket is simply any socket on any platform which is listening for a connection.
a client socket can be any socket which is connected to a server socket.
This has nothing to do with the fact that the actual computer is a server or client. a server machine can connect to your personal computer, but its socket is still called the 'client' socket.
There may be limits on the number of connections an OS can accept at once, etc., but still, that doesnt stop you from using even windows 3.1 sockets as 'server' sockets.
|
|
|
|
|
thank u for the message.
so, for example, CSocket can work as both 'accept' - just call it server - and 'connect to the accept' - just call it client.
both can be on any win/nt platform.
in java, there are 2 different sockets: ServerSocket and Socket, according to ur opinion, there is no such symmetric things in c++ for win/nt?
is my understanding right?
regards
includeh10
|
|
|
|
|
There are Java-style socket libraries for C++ that implement separate Socket/ServerSocket classes. Or if my recollection is false, you can implement one yourself;)
|
|
|
|
|
I write a data server, which just simply open an ADO recordset in the server, and sends data to the client. The client will also maintain a RowList. However, I'm when a user Added a new record locally, I don't know where I should put the record in, as it has to be in the same position as the server's one, otherwise the records are not synchronized with MoveNext, MovePrevious operations.
say, in the 3 record, the user AddNew and save. I should put the newly added record in the 4th position, and in the Server's recordset, i do the same in the 3rd record, and the record will go into 4th position in the server's recordset too ???
|
|
|
|
|
i try to run a program from c++, but how to get info from io stream?
i.e. run javac.exe, it displays a lots info in command window, i want to get the info to my c++ app at run time.
if use java Runtime class, i can do it, but i want to use c++ now.
please help!
includeh10
|
|
|
|
|
|
If that's too "heavy", and onlystdout is needed, a plain call to _popen will do. Example
#include <stdio.h>
#include <stdlib.h>
void main( void )
{
char psBuffer[128];
FILE *chkdsk;
if( (chkdsk = _popen( "dir *.c /on /p", "rt" )) == NULL )
exit( 1 );
while( !feof( chkdsk ) )
{
if( fgets( psBuffer, 128, chkdsk ) != NULL )
printf( psBuffer );
}
printf( "\nProcess returned %d\n", _pclose( chkdsk ) );
}
|
|
|
|
|
good idea, thanks. i will try more once i have time.
cheers.
includeh10
|
|
|
|
|
What is the wrong ?
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
class MyMath
{
public:
friend int Sum(int v1, int v2);
};
int Sum(int v1, int v2)
{
return v1 + v2;
}
void main()
{
MyMath obj;
cout << "Result: " << obj.Sum(1, 3);
_getch();
}
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Your MyMath class's Sum function is public to other classes so there is not need to declare it as friend. And you can declare the method as friend if you are writing a class template(generating new classes depending upon what type of parameters you pass to the function). In your code I do not see a reason for declaring it as a friend or also it not possible to declare it as a friend.
Einstein's Assistant
|
|
|
|
|
Hi.
I have uploaded my whole application in my temp. yahoo account. I could not locate the source of memory leak. Please help me to pin point source of serious memory leak. I have uploaded a zip file in the yahoo briefcase.
Yahoo details
userid : moswal0071
password : cooldude
Thanx in advance.
Einstein's Assistant
|
|
|
|
|
Can anyone provide an example of a circular queue in C? I've never used one before and researching on the net has shown a whole host of approaches of which I think have alot of overhead.
1) I don't want to and can't use STL since this is a C program.
2) All examples I've seen use data structures like a linked list with "next" pointers and one of the attributes is the data itself.
3) They also have all of the functions which add, delete, check for empty, etc. but I don't want to spend the time doing this for the reason specified below. I don't want to call functions but do this on the fly as I add or remove data from the queue.
4) I'm reading from a serial port at 115k baud in a read thread and don't have any time to format the data so I would like to do a memcopy to an array or circular buffer so it must be contiguous but then there is the wraparound problem I'm aware of. Worst case, a for loop. I will process or format the data into it's proper format in another thread which will access this circular queue as the read thread is putting data into it.
5) Shouldn't it be as simple as a char array of certain size with two char pointers; one to head and one to tail? I know how to see if the queue is empty but how do I detected overrun? If detecting overrun is simply is head > tail then what about when I wrap around to the beginning of the buffer?
Any code examples and suggestions would be appreciated.
John
|
|
|
|