|
That is a different error: now your code compiles correctly but you have a linker error. It simply means that your function is known by the compiler (you provided a prototype) but no implementation has been found. So, provide an implementation and that will probably solve the problem.
|
|
|
|
|
Cedric Moonen wrote: Member functions and globabl functions don't have the same prototype
But the method fncSame is not a global function
But I do see what you mean and why that would be a possible issue.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
|
|
|
|
|
Mustafa Ismail Mustafa wrote: But the method fncSame is not a global function
No, but that's what I said. Your typedef defines a pointer to a global function, not for a class method. And your fnSame is a class method.
So, they are not compatible.
|
|
|
|
|
Thanks Cedric, got it working
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
|
|
|
|
|
hi friends,
i have a very basic doubt regarding the file operations using FILE * fp.
i.e. how can i delete a record from a file.
|
|
|
|
|
Basically deletion of data from a file requires the following steps
1. Create a new file
2. Copy all the content from source file, excluding the data to be deleted
3. Delete the source file
4. Rename the new file as the source file
- NS -
|
|
|
|
|
thanks boss,
but till now i had been implementing this technique.
i wanted some straight forward alternative.
thank you.
|
|
|
|
|
If you work with records (formatted data) you can make a flag that the record is deleted. Than you have only to change a byte in the file.
Greetings from Germany
|
|
|
|
|
I had the same problem once. And I made it as KarstenK has said.
I was setting a flag that meant "deleted" but with one difference. That was only while the programm was running. When the programm was closing (OnDestroyWindow (), OnCloseDocument () or any other message you want to use) I made an update from file doing the process that NS17 has told you. Is the only process I know to do it with FILE. Another thing is with CArchive and its Serialize.
Making it so, you have max quickness during programm execution but the report stays in "desirable" limits. If not, after some "days" you may have a report with lots of deleted members which flag has to asked too know if they are valid or "deleted"
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I am making project in vc++ and i got problem of the unhandled violation in vc++ MFC.
whenever I create the object of other class in same class and then I use it for some operation then I got this error. My Error is like below.........
0xC0000005: Access violation reading location 0xccccccd0.
Plz kindly Reply me if you have any solution.
Thanks in Advance.
Ashish Bhatt
|
|
|
|
|
Plz post Some code that u write in your application.
so i can help.
hiren thakkar
|
|
|
|
|
I have Classes like below
TestRTMPDlg ///Main Dialog class
RTMPBuffer
RTMPClient
RTMPSocket
When i declare object of RTMPBuffer class in RTMPClient class in header file and then I call the function of RTMPBuffer class then i got the run time error like.......
/////////////////////////////
Unhandled exception at 0x004196c8 in TestRTMP.exe: 0xC0000005: Access violation reading location 0xccccccd0.
//////////////////////////////////
Plz Reply yar if u got some solution.
ok bye.
Ashish Bhatt
|
|
|
|
|
Probably you have a pointer variable which did not intialized properly. Or you try to copy variable to another variable which was not reserved using "new". Check your RTMPBuffer class.
Ian
|
|
|
|
|
ashish , when u got the error then u got abort retry box. then click retry button then press
alt + 7 then u got call stack. click line in call stack one by one . then u got the line on which got error . send me that line.
if code is not large then mail me. i will check it.
hiren
|
|
|
|
|
|
You've posted no source and no call stack; how can we possibly help given such limited data?
Steve
|
|
|
|
|
////////////////RTMPClient.cpp/////////////////
#include "StdAfx.h"
#include "RTMPClient.h"
#include "RTMPBuffer.h"
#include "VSocket.h"
RTMPClient::RTMPClient(void)
{
//m_sock =NULL;
m_buff = new RTMPBuffer();
}
RTMPClient::~RTMPClient(void)
{
}
BOOL RTMPClient::SendRectangle(RECT &rect)
{
char str[100];
sprintf(str," In RTMPClient Bottom %d,Right %d",rect.bottom ,rect.right);
MessageBox(NULL,CString(str),CString("TestRTMP"),0);
RECT sharedRect;
{
//omni_mutex_lock l(m_regionLock);
//sharedRect = m_server->GetSharedRect();
}
sharedRect.left = 0;
sharedRect.top = 0;
sharedRect.right = 1280;
sharedRect.bottom = 1024;
BOOL res = IntersectRect(&rect, &rect, &sharedRect);
if(res)
{
sprintf(str," In RTMPClientBottom %d,Right %d",rect.bottom ,rect.right);
//MessageBox(NULL,CString(str),CString("TestRTMP"),0);
}
// Get the buffer to encode the rectangle
m_buff->TranslateRect(rect,m_sock,sharedRect.left,sharedRect.top);
//UINT bytes = m_buff->TranslateRect(rect,m_sock,sharedRect.left,sharedRect.top);
// Send the encoded data
// return m_socket->SendQueued((char *)(m_buffer->GetClientBuffer()), bytes);
return TRUE;
}
///////////////RTMPClient.h//////////////////////
#include "RTMPBuffer.h"
#include "VSocket.h"
#pragma once
class RTMPClient
{
public:
RTMPClient(void);
~RTMPClient(void);
BOOL SendRectangle(RECT &rect);
public:
RTMPBuffer *m_buff;
VSocket *m_sock;
};
|
|
|
|
|
You haven't indicated where the crash is occuring! If you don't know run it in a debugger and find out.
Steve
|
|
|
|
|
In RTMPClient.cpp file
Program Crash on this line.......
//////////////////////////////////
UINT bytes = m_buff->TranslateRect(rect,m_sock,sharedRect.left,sharedRect.top);
//////////////////////////////////
it shows the unhandled exception like below......
/////////////////////////////////////////
TestRTMP.exe: 0xC0000005: Access violation writing location 0xcccccccc.
//////////////////////////////////////
|
|
|
|
|
on which line u got the error..
may be in this line?
m_buff->TranslateRect(rect,m_sock,sharedRect.left,sharedRect.top);
hiren
|
|
|
|
|
yes on this line i got error
if i initialize it with new operator in constructor then also it gives same error.
|
|
|
|
|
i think it is due to m_sock . which is not being initialize yet..
make simple function without any arument then try that function .i think u will defiantly not get any error.
|
|
|
|
|
I can't see a memory write operation on this line. Show the call stack and the machine code around the crash.
Steve
|
|
|
|
|
ashishbhatt wrote: char str[100];
sprintf(str," In RTMPClient Bottom %d,Right %d",rect.bottom ,rect.right);
MessageBox(NULL,CString(str),CString("TestRTMP"),0);
May I suggest:
CString str;
str.Format(" In RTMPClient Bottom %d,Right %d", rect.bottom , rect.right);
AfxMessageBox(str); ashishbhatt wrote: m_buff->TranslateRect(rect,m_sock,sharedRect.left,sharedRect.top);
What is the value of m_buff at this point?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I think the best advice one can give you is to learn to use your debugger. This kind of errors can be easily fixed and quite quickly if you know how to use the debugger (and certainly much faster than asking on a forum).
So, press F5 to start your debugger. You will be able to set breakpoints in your code with F9 (breakpoints are points in your program where the execution will stop, allowing you to inspect the variables). Then, first localize where the crash occurs (and the callstack can be usefull there) and then you can inspect the different variables to see if everything is as expected.
|
|
|
|