|
You probably want to start Here[^]
Normally, when one says ping, that means sending icmp-echo packets and listening for icmp-reply, which requires root privileges, so keep that in mind when developing your solution.
Good luck.
|
|
|
|
|
You may find many examples of ping C source code just Googling for.
|
|
|
|
|
he probably not want to code the ping itself, but how to call it .
I'd rather be phishing!
|
|
|
|
|
struct node{
int key;
node* head;
}
node *head = NULL;
void func(node* &h,int n, int m)
{
if(n > m)
return;
else {
int mid = (n+m)/2;
func(h->head,n,mid-1);
func(h->head,mid+1,m);
}
}
I am wonder what is the difference of parameter:
func(node* &h, int n, int m)
and
func(node* h,int n, int m)
what is the usefulness of node *&h.
|
|
|
|
|
econy wrote: what is the usefulness of node *&h. It is a pointer to a reference. You can modify the pointer itself rather than the object that the pointer is pointing to.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
DavidCrow wrote: It is a pointer to a reference.
Please forgive me if I'm wrong, but isn't it a reference to a pointer, instead?
The difficult we do right away...
...the impossible takes slightly longer.
modified 23-Sep-15 18:40pm.
|
|
|
|
|
Possibly. I've actually never used either (if both are valid concepts) so I could be wrong.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Pointer to reference is not valid, since a reference is not an object.
|
|
|
|
|
func(node* &h, int n, int m)
h is a INOUT parameter, if func changes h then the caller see the changed value (that is after function execution, h could point to another address).
func(node* h,int n, int m)
h is a IN parameter, if func changes it, the caller doesn't see the changed value.
|
|
|
|
|
help at the time of compiling this error appears at the end
by compiling visual studio 2013 through the makefile.vc
<pre lang="vb">fba_ggpo.o : error LNK2001: símbolos externos indefinidos "bool __cdecl VidSSetQuarkConnectStatus(wchar_t const *)" (?VidSSetQuarkConnectStatus@@YA_NPB_W@Z)
fba_ggpo.o : error LNK2001: símbolos externos indefinidos "int __cdecl VidSSetQuarkShowLogo(bool)" (?VidSSetQuarkShowLogo@@YAH_N@Z)
fba_ggpo.o : error LNK2001: símbolos externos indefinidos "int nAcbVersion" (?nAcbVersion@@3HA)
</pre>
|
|
|
|
|
That error is telling you that the linker cannot find the implementations of the three functions named in the error messages.
See: LNK2001[^]
Are you calling functions that you haven't implemented? This error can happen if you include a header (.h) file without also having the implementation (.cpp) file as part of the project.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thanks buddy that was the error
|
|
|
|
|
You have most likely failed to include the library that contains these functions. Check your project settings.
|
|
|
|
|
how do i create multiple threads to fetch words from the input file and insert them into the dictionary in c.
|
|
|
|
|
|
CreateThread()
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
hello,
I'm a begginer with win32 api, and i try to make a SysListview32 (aka WC_listview) with draggable columns to modify it order with the mouse. To do this, i create it with the LVS_EX_HEADERDRAGDROP etended style, like this :
ListView = CreateWindowEx( LVS_EX_HEADERDRAGDROP, WC_LISTVIEW, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | LVS_REPORT, 0, 0, RectParent.right, RectParent.bottom, hwnd, NULL, hInstance, NULL );
The listview appears correctly with columns and items, but don't work when i try to move a column with mouse. Do i forget something ???
Thank you in advance !!
|
|
|
|
|
LVS_EX_HEADERDRAGDROP is a extended style, that is why should be setup not there, but using SetExtendedStyle method:
ListCtrl.SetExtendedStyle(LVS_EX_HEADERDRAGDROP);
I don't know Win32, but I am sure there is SetExtendedStyle Win32 function ...
|
|
|
|
|
I have a c++ class that contains the following:
template<class T> class Poly {
public:
Poly<T>(int order = 0)
{
this->order = order;
coeffs = new double[order+1];
for( int i = 0;i<=order; i++ )
coeffs[i] = 0;
}
Poly<T>( int order, T *coeffs);
Poly<T>( Poly &poly );
~Poly()
{
delete []coeffs;
}
// other member functions are not shown.
friend ostream &operator << ( ostream &out,
Poly<T> &poly );
private:
// data members not show.
};
This class is defined in a file called poly.h. In the file poly.cpp, I have the following function definition:
template<class T>
ostream & operator << ( ostream &out, Poly<T> &poly )
{
bool printedCoeff = false;
.
.
.
return out;
}
In a third file called test.cpp, I have:
double coeffs[] = { 3, 1, 2, 1 };
Poly<double> p1(3,coeffs), p2;
cout << p1 << endl;
I am using the Microsoft Visual Studio and I get a linker error because of the statement:
cout << p1 << endl;
I believe that my definition of the function overloading << is
not properly getting instantiated. How do I fix this?
Bob
|
|
|
|
|
|
I am trying to use GDI+ within my MFC dialog based application with multiple child dialogs. On one of the child dialogs, I am trying to draw an image from an array of 8 bit BYTE pixel data. Here is how my flow process is for this-
Variables declared in my child dialog's header file.
LONG DIBSecWidth;
LONG DIBSecHeight;
LONG BitsPerPixel;
LONG Stride;
BITMAPINFO* bmi;
BYTE* pDIBSectionBits;
HBITMAP hbm;
Graphics* imagedisp;
Bitmap* offscreenBitmap;
RECT m_imagedisp_rect;
BOOL m_BUpdate;
Then in my OnInitDialog() function, I do the following
DIBSecWidth = 512;
DIBSecHeight = 512;
BitsPerPixel = 8;
Stride = ((DIBSecWidth* BitsPerPixel + 31L) & (~31L)) / 8L;
bmi = (BITMAPINFO *)new BYTE[sizeof(BITMAPINFO) + UCHAR_MAX * sizeof(RGBQUAD)];
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi->bmiHeader.biWidth = DIBSecWidth;
bmi->bmiHeader.biHeight = DIBSecHeight;
bmi->bmiHeader.biPlanes = 1;
bmi->bmiHeader.biBitCount = (WORD)BitsPerPixel;
bmi->bmiHeader.biCompression = BI_RGB;
bmi->bmiHeader.biSizeImage = 0;
bmi->bmiHeader.biXPelsPerMeter = 0;
bmi->bmiHeader.biYPelsPerMeter = 0;
bmi->bmiHeader.biClrUsed = 0;
bmi->bmiHeader.biClrImportant = 0;
memcpy(bmi->bmiColors, summercmap, 256*sizeof(RGBQUAD));
hbm = ::CreateDIBSection(NULL, bmi, DIB_RGB_COLORS, (void**)&pDIBSectionBits, NULL, 0);
offscreenBitmap = new Bitmap(bmi, pDIBSectionBits);
ImageDisplay.GetClientRect(&m_imagedisp_rect);
imagedisp = new Graphics(ImageDisplay.GetDC()->GetSafeHdc());
m_BUpdate = true;
and in OnPaint() message handler I have the following
CPaintDC dc(this);
if (m_BUpdate)
{
BYTE *pCurRowPixel = (BYTE *)(pDIBSectionBits);
memcpy(pCurRowPixel, m_pImgBuffPrc, DIBSecWidth*DIBSecHeight);
imagedisp->DrawImage(offscreenBitmap, 0, 0, DIBSecWidth, DIBSecWidth);
m_BUpdate = false;
delete pCurRowPixel;
}
Whenever I run my application, it throws an error at imagedisplay->DrawImage function, if I comment it out it doesn't throw the error. I am sure there is something simple that I am missing here or the way I am trying to draw is not right, any ideas/suggestions?
thanks
PKNT
modified 21-Sep-15 13:49pm.
|
|
|
|
|
Quote: delete pCurRowPixel;
What's the purpose of the above line? It looks plain wrong, to me.
|
|
|
|
|
I saw that too. But it is guarded by m_BUpdate .
|
|
|
|
|
The crashing call too is guarded by m_BUpdate .
Anyway, it is wrong calling delete on the memory allocated via CreateDIBSection .
|
|
|
|
|
CPallini wrote: Anyway, it is wrong calling delete on the memory allocated via CreateDIBSection .
Which might be the reason for the exception because <code> _BLOCK_TYPE_IS_VALID is thrown when trying to delete memory that wasn't allocated using new .
|
|
|
|