Platform-Independent Way to Obtain IP-Address in C++ [duplicate] - c++

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Get the IP Address of local computer
I want to be able to get the IP address for the machine I'm on in C++ without querying external www.whatsmyip.com, but also want to do it in a platform-independent way. I can find specific examples for both Windows and Linux, but can't think of an easy way to do this in a platform-independent way. I would also consider options of putting an if-statement in depending on the Operating System if this seems like the best/only method.

If you are able to use boost, I highly recommend the boost::asio, which is about as cross-platform as you're going to get.

An alternative to boost::asio may be the POCO Network Library.

Related

how to get BIOS information in c++ [duplicate]

This question already has answers here:
How to read a value from the Windows registry
(8 answers)
Closed 6 years ago.
we are working on something in that requires BIOS information, i know that these information is available in HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System registry setting. But i need to do this in C++.
is there any API available for this?? i dont want to read from the system registry due to some limitation on client system.
Is there any other way to do this??
If you already know that the values are stored in a registry hive, then you could use CRegKey to read the values. This is just an ATL wrapper around Windows registry manipulation APIs.
If you want to use a Windows API instead, there's RegQueryValueEx.
Keine has also given you an excellent link in a comment, which discusses several things and also has a link that's detailing the 32/64 bit registry gotchas.

Is there a way like man, info, perldoc etc to get help info about C++? [duplicate]

This question already has answers here:
Where are the man pages for C++? [closed]
(8 answers)
Closed 8 years ago.
I have some experience with Bash, Perl and R. I find it is very convenient to get help info with these three programming languages. However, when I start with C++, I fail to find such a help system. Did I miss something? Or, there is no such system at all?
Another problem puzzling me is C++ libraries. How to start to learn a new library? Is there a convenient way to get all the member functions for a new class? Or, do we have to read the header files to get the methods for the class?
Thanks!
If you have experience with bash, then you must be familiar with unix or linux systems, you can use man command like man 2 fwrite to find the standard c library manual for fwrite function.
However, for c-plus-plus, the manual is not inside the man directory by default (so far as I know).
You can download c-plus-plus manual from 'http://gcc.gnu.org/mirrors.html' to use manual for c++ standard library. Or try to use dash on Mac computer or Velocity on Windows platform instead. Besides, reading the manual from 'http://en.cppreference.com/w/' is my favorite way.

Equivalent to windows.h for mac [duplicate]

This question already has answers here:
Where can I get windows.h for Mac?
(3 answers)
Closed 4 months ago.
Is there any equivalent to windows.h for mac?
I've been googling it but I can't find anything.
I don't know if it matters but I am currently using Mountain Lion.
There is no direct equivalent. That is, no file for file substitute. It's a different platform after all. You will simply have to work with their API. And without knowing exactly what it is you want to do and what functionality you intend to use, it's hard to provide any additional information.
There is the Carbon API. Or better said, there was. Specifically since Mountain Lion, this API has been deprecated. The aforementioned link mentions some alternatives to deprecated functionality, though the Objective-C route might be a more easily manageable alternative.

Seeking C++ implementation of `hires_time_in_seconds()` [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
High resolution timer with C++ and Linux?
double hires_time_in_seconds();
I'm looking for this function for Windows, Linux too if you have it.
It is mentioned in http://gafferongames.com/game-physics/fix-your-timestep/.
I've looked on the web.
I know it's not a standard function but if anybody has an implementation that they want to share, that would be great.
Failing that, I need something as fine grained as possible to do synchronization in a client server game.
It's not a real function, it's just a self-descriptive placeholder name used in that blog post's example code.
For Windows, you'll want to use QueryPerformanceCounter along with QueryPerformanceFrequency. For Unix-based OSes, you'll want to use gettimeofday(3).

detect currently installed anti-virus [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicates:
Detect Antivirus on Windows using C#
How to detect if a virusscanner and/or firewall is installed? (And a few other security-related Q's.)
is there a way to detect currently instaled av without searching for known processes?
Yes there is. You can use WMI, I assume you are asking about Windows, to check installed instances of an anti-virus program. It is quite simple from C# and this link gives a good explanation of how to do it. It is also possible to access WMI from C++ and that is explained here. Also for anything WMI related I highly recommend the WMI Studio.
It depends on the AV software and the OS but it looks like you can use WMI. Here's an example on using WMI script - using WMI from C++ is outside of my knowledge, sorry.
http://blogs.msdn.com/b/alejacma/archive/2008/05/12/how-to-get-antivirus-information-with-wmi-vbscript.aspx