Trouble with reading JSON files in C++ - c++

I want to read data from a JSON file in C++, and I know there are several different libraries I can use. The problem is, I need to send the code to someone once it's done, and I need this person to be able to run the code in their IDE without installing anything.
All the JSON libraries in C++ require installation, so I don't know how to proceed. Any ideas?
Thank you

Related

libtdms: How to access the metadata of the .tdms file in order to process it?

For reading .tdms file with c++ I downloaded libtdms from sourceforge.net. I use Visual Studio 22 on Windows so I also installed MinGW for executing the Makefile.
The library does what it should, reading the .tdms file, but I dont know how to access the data in order to process and visualize it. Do I have to look inside the variables of libtdms?
Is there an easier way of outputting some kind of table with all the informations without getting deep into the code. (not that easy as mechanical engineer)
How do I include the full library dictionary with its makefiles into a possible programm?
So far i only included single .h files when programming
My goal is to get measurements from the .tdms file (values, coordinates,...) an then use them for plotting datapoints 2D and 3D.
this kind of output would be helpful for processing the data further

Testing the opening of files using QTestLib

I am new to unit testing and the Qt framework. I have been assigned to write a unit test to test the opening of text files.
I have looked the the tutorials for Qt test. But I have no idea how to proceed. (I have to use QTestLib). Please guide me what I should do.
Boost libraries are being used to open the csv and delimited text-files to import the data in the application.
By testing, I am assuming that you want to check if the files are being read properly.
1) To get a better understanding about the Qt Project structure, check out this link
2) Locate the class that is actually calling the boost libraries to read the data, you might want to test this class (It depends on you how you want to implement, without any details, I cannot give a better explanation)
3) Create the corresponding object and invoke the reading of the file. After the file has been read, you can QVERIFY or QCOMPARE the data read by the class and the actual values. To use custom datatypes in the previous functions, look at this link. It is explained in the website, how to create and use custom datatypes for the above functions.
4) To run multiple tests in a single Test project (Qt), look at this github repo (I'm unable to find the website where it was originally posted).
I hope this gives an idea of how to get started with writing the test. It really depends on what your requirements are, without knowing the details, I might not be able to help more

Saving a webpage to disk using C++

I've managed to download a "file" from the internet with the help of wininet library, but I can't seem to save a "webpage" i.e. something I can edit later on with a text editor or with ifstream.
In this case, what are the tools I should resort to? Can wininet save a webpage to disk? Should I consider cURL (though I haven't managed to download regular files due to lack of documentation of cURL)? Do I need to learn what's called socket programming?
NB: I'm on Windows, using MinGW but can switch to MSVC if necessary, I'm looking for source code in the webpage, eventually I'm after the text in a webpage.
Also, I am not familiar with any of the functions in wininet, curl, or sockets. What do I need to learn of these?
Any help is greatly appreciated!
If your program is going to run both on windows and unix, then use cURL. Otherwise, stick with MSVC and WinINet functions http://msdn.microsoft.com/en-us/library/windows/desktop/aa385473(v=vs.85).aspx It's much easier to use in terms of the efforts required to get your program running and distributed (esp. if you're not linking your program against cUrl statically. Otherwise, you'll need to take libcurl.dll everywhere your program runs on Windows). With WinINet, you simply need to include a header and a library to use the functions.
If you're going to use WinINet, refer to this code snippet: http://www.programmershelp.co.uk/showcode.php?e=57
Use the same code except for the while loop. Instead of reading one byte at a time, read them by chunks and write them to the output file handle.
If you're going to use cURL, refer to this post: Download file using libcurl in C/C++

Generating a C++ classes from IDL file using MICO (CORBA)

I wan to generate a C++ classes from a IDL file using MICO in the contxet of CORBA. I download the mico-2.3.13.zip but iI don't know how to use it. Please if someone can help me and thanks all.
The answer would probably be longer that would comfortably fit in a short reply, but here are some pages with helpful starter info.
This class webpage has a mini tutorial using mico
http://www.cs.wichita.edu/~chang/lecture/cs843/program/mico-idl.html
Here's another fairly simple tutorial page
http://people.inf.ethz.ch/roemer/micodoc/node16.html
You first need to compile MICO from the sources. Depending on your operating system and environment this will require different steps. In linux/mac os x they are basically calling the ./configure script and then make if it did not fail. Under windows I think that you can call nmake directly (with some options, read the README files).
After compilation completes (this may take a few minutes) and if everything goes fine, you should have the executables and can use them to create your own CORBA interfaces and services.

How to send files b/w two machines through socket programming?

I have requirement to send all the files in the directory to a different machines, the directory may internally contain child directories.
Is there any help available on this?
One more doubt is: I also heard that we can send the files using FTP, if so which is the best between the two. Is there any help available for this?
I need to implement this on windows platform using vc++/c++
Thanks
One possibility is the TransmitFile() function in the windows API. You'll have to traverse the directories to find individual files with your own code.
You should probably combine and compress the files/directories on the source end.
Transmit and unbundle on the other end.
A library to help (that is free) is bzip (http://www.bzip.org/)
You should be able to do everything in memory if you do it well but potentially you can also use intermediate files.
Sounds like a homework problem.
FTP uses sockets internally.
Make an initial try at the problem and post it here. You'll get more help if people think you are trying, rather than just freeloading.