|
Have you tried gethostbyname() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello Mr David,
I tried that,but i could able to get only the Public IP address, i,e the Internet IP address. but how can i find out the internal ip address of that system
Gopinath MV
|
|
|
|
|
How, or why, are you distinguishing between "Internet" and "internal?"
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Actually, i got a requirement, where i have to get the IPaddress of the system and also its local IP address if it is connnected with in a lan.
and i mean the local ipaddress is the internal ipaddress.
For example my system IPaddress are
E.g : Internet IPaddress : 219.91.165.43
Internal IPaddress : 192.168.0.9
how to get them
Gopinath MV
|
|
|
|
|
gloriousgopi wrote: E.g : Internet IPaddress : 219.91.165.43
Are you sure this isn't the address of some firewall or gateway? Is the name of your machine 43-165.91.219.static.iqara.net?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i just gave an example, those are not exact.
Gopinath MV
|
|
|
|
|
gloriousgopi wrote: but how can i find out the internal ip address of that system
The "internal" ip of the remote system is useless from the outside anyway.
If you MUST have it you can have the server send it to you when you connect.
Mark
|
|
|
|
|
Actually, i got a requirement, where i have to get the IPaddress of the system and also its local IP address if it is connnected with in a lan.
and i mean the local ipaddress is the internal ipaddress.
For example my system IPaddress are
E.g : Internet IPaddress : 219.91.165.43
Internal IPaddress : 192.168.0.9
how to get them
Gopinath MV
|
|
|
|
|
I understand what you want. You can't get it from outside the LAN. Maybe there's a way to
hack in to the router LOL. I would hope not.
Have your server (behind
the NAT) call gethostname(). That will give you the local (LAN) ip address. Send that address to your
client outside (on the WAN).
Call getpeername() from the client to get the server's public (WAN) ip address.
gloriousgopi wrote: Actually, i got a requirement...
Not much you can do with that address from outside the LAN except display it.
Why the requirement? If you can be a little more specific maybe there's a solution.
Mark
|
|
|
|
|
Just i have to display the address, thats it.
Gopinath MV
|
|
|
|
|
Have your server (behind the NAT) call gethostname(). That will give you the local (LAN) ip
address. Send that address to your client outside (on the WAN).
Mark
|
|
|
|
|
Hello, I have to fill a parameter from an edit box, which is later used when creating an sql statement.
Are there any special characters in addition to "*" which I may not use ?
And is there any possibility to easyly avoid that a user enters a "*" into the edit box ?
Greetings
|
|
|
|
|
Checker2003 wrote: Are there any special characters in addition to "*" which I may not use ?
That would be up to the application requirements. You may want to limit it to just letters, or numbers, or both. You may want to include a few special characters.
Checker2003 wrote: And is there any possibility to easyly avoid that a user enters a "*" into the edit box ?
By deriving a class from CEdit and overriding the OnChar() method, you can allow/reject whatever character you choose.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
thx a lot, but I am very new to c++, how can I handle it with this CEdit overriding ?
Thank you very much
|
|
|
|
|
You probably want to look in the articles section of the site, there's bound to be plenty of examples there, you can probably find one that does what you want and just use it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Also, you may want to look for articles on avoiding SQL injection.
You don't want users(hackers) to be able to enter SQL statements that get combined with
your embedded statements.
Checker2003 wrote: Are there any special characters in addition to "*" which I may not use ?
Apostrophe can cause problems too
Mark
|
|
|
|
|
How can i search into my database for a string ?
this is my code :
but is not working i dont have any rezult !!!!
i Dont now what i can do ? please help me !!!
void CDatabaseTest::OnChangedb()
{
CWaitCursor wait; // Display a wait cursor
m_Db.GetWindowText(sTextDatabase);
sTextDatabase.TrimLeft();
sTextDatabase.TrimRight();
CDatabase_1BunView1 *pBun = new CDatabase_1BunView1;
if (!pBun->Open())
return;
pBun-> m_strFilter = "SELECT Bun.um ; FROM Database_Nou!Bun ; WHERE Bun.um = '" + sTextDatabase + "'";
if (pBun->IsOpen())
while(!pBun->IsEOF())
{
if(pBun->m_strFilter == sTextDatabase)
{
m_dengestiuneDb.SetWindowText("GGGGGGG");
}
}
pBun->Close();
delete pBun;
}
Bravoone
|
|
|
|
|
So what's not working? When you step through the code using the debugger, what are you seeing?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Bravoone_2006 wrote: "SELECT Bun.um ; FROM Database_Nou!Bun ; WHERE Bun.um = '" + sTextDatabase + "'";
Have you tried entering this SQL statement in the DB console and looking at the results to see if there are actually any?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
yes but are no results because sTextDatabase this string are from my program .
and i rewrite my code and he look like this :
void CNcontabile::OnChangedb()
{
CWaitCursor wait; // Display a wait cursor
m_Db.GetWindowText(sTextDatabase);
sTextDatabase.TrimLeft();
sTextDatabase.TrimRight();
CDatabase_1BunView1 *pBun = new CDatabase_1BunView1;
pBun-> m_strFilter = "um ='" + sTextDatabase + "'";
pBun->Open();
pBun->GetRecordCount();
pBun->MoveFirst();
while(!pBun->IsEOF())
{
if(pBun->m_strFilter == sTextDatabase)
{
m_denDb.SetWindowText("GGGGGGG");
}
}
pBun->Close();
delete pBun;
}
he tell me sql column ( what i insert in the string) is not found !
please help me!
-- modified at 6:45 Tuesday 17th October, 2006
Bravoone
|
|
|
|
|
Bravoone_2006 wrote: ...but are no results because sTextDatabase this string are from my program .
And that matters how? Just use a string literal (equal to whatever sTextDatabase would otherwise contain at runtime) in the DB console. Quite making this overly complicated.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i dont understand can you give me an example or be more ...
Bravoone
|
|
|
|
|
Bravoone_2006 wrote: i dont understand...
What's not to understand? Do you know how to use a SQL statement in the DB console?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all,
I need to open a file using Win 32(MFC API).. read each line from it, and after reading all the line i've to replace each char in the file with a random number.. after that i've to delete that file....
It's very urgent..i'll be very grateful if anyone provide the solution....
bye
kamalesh
|
|
|
|
|
Since the net result is to delete the file, why bother with the character replacement? In any case, just use DeleteFile() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|