C++ analogue for -lspci command - c++

I need to search for Hardwares in linux environment based on Vendor IDs programmatically using C++.
I know that I can get the list using
-lspci
Can anyone throw some light here??
Thanks and Best Regards

The lspci program uses libpci internally. Both the program and the library are part of the pciutils package. To use libpci programmatically from C or C++, I suggest taking a look at the example.

Related

How to write to, edit, and retrieve specific cells from an Excel doc with C++?

Basically, I want to be to be able to pass data between Excel cells and
my C++ program. I don't have any experience in Excel/C++ interactions and I haven't been able to find a coherent explanation or documentation on any websites. If someone could link me some references or provide one themselves it would be much appreciated. Thanks.
If this is for a Windows system, you could always use one of the available managed Excel libraries, such as OfficeWriter or Aspose.
There also might be similar libraries specifically for c++, I know we (OfficeWriter) used to make one.
Edit: Looks like there are a few out there, like LibXL and BasicExcel.
If the application will run on an end user machine with Excel installed, you can easily use the Excel interop and keep Excel hidden.
In addition to LibXL and BasicExcel mentioned by smoore, there is:
ExcelFormat Library is an improved version of the BasicExcel library and will allow you to read and write simple values. It is free.
xlslib will also read and write simple values, I have not tried it tho. It is also free.
Number Duck, is a commercial library that I have written, It supports reading and writing values, formulas and pictures. The website has examples of how to use the features.

How to determinate the build of app (x86 or x64) without using SDK/libs etc

I want to determinate the build of the program. It can be running or not. Also I EXACLTY want to determinate such thing in my code without using any SDK or some-ready stuff from .net fw etc...
How to do it?
Question isn't about the exact language. It may references to the plain/pure C, Lisp, Basic etc...
The thing I want to know is "determination without using help-stuff like sdk etc".
PS
Please! Pay attention. I've highlighted "without ready stuff like sdk", using consoles and utilities like 'dmesg', 'dumpbin' etc... Also doesn't make sense in this Q. It's more about reviewing the binary of the file by yourself without any help from another programs.
Linux uses "elf" executables. Checkout the elf spec for details on how to read the file directly.
Windows uses "pe" format executables. See the pe/coff spec for details.

What library should I use to get the data from a photo of a QR Code?

Similar: Does anyone know of a C/C++ Unix QR-Code library?
I tried libqrencode but apparently it's only able to generate a QR-Code. However, I need a library that reads the data from a photo of a printed QR-Code.
It must be a C, C++ or Objective-C library and it has to compile on BSD systems. On my platform, Java and .NET are not available.
What libraries can I use?
Thanks.
Try using libdecodeqr , it doesn't seem to be updated for over a year but a Google search reveals that it still works.
zxing (http://code.google.com/p/zxing/) is probably the most well-known and used in a number of barcode/qr-code apps. The original/primary code is Java but it includes a C++ port that is pretty actively maintained, particularly for QR codes.
The C++ library does not (currently) have an encoder, but it sounds like you want a decoder.

C++, console Application, reading files from directory

I have a directory and I want to read all the text files in it using C++ and having windows OS also using console application
I don't know the files' names or their number
thanks in advance
Take a look at Boost.Filesystem, especially the basic_directory_iterator.
If you want the C++ and portable way, follow the solution by #Space_C0wb0y and use boost.Filesystem, otherwise, if you want to get your hands dirty with the Windows APIs, you can use the FindFirstFile/FindNextFile/FindClose functions.
You can find here an example related to them.

Is there any standard way to load parameters from a file in C++ on Linux?

Imaging that a program needs to know quite a lot of parameters to do its tasks properly, such as 'Port = 2323' this kind of things.
now I want to save these parameters in a plain text file, similar to Unix' system variables such as users and groups.
Is there any standard way/libraries that can help me to do this? Does anyone ever used them before? thanks
Boost.Program_options library. Is this you are looking for?
The program_options library allows program developers to obtain program options, that is (name, value) pairs from the user, via conventional methods such as command line and config file.
Qt offers this by default, and in a cross-platform way. Checkout out QSettings
You can also create an alias or shell script that executes your program with given parameters. To conviniently get these parameters there's "getopt"
Link here for a cross platform ini handler.
Hope this helps.