Example C++ source code:
The FC++ API will throw a C++ exception if a problem is detected, so there is no need to perform error checking after every call. The only exception object thrown from the FC++ API is fc::Exception which inherits from std::exception.
Additional example files:
File | Description |
---|---|
example001.cpp | Getting started with fc::Control and fc::Options. This includes several simple tasks such as directory listings using fc::Control::getDirectoryListing() and MD5 checksums with fc::Control::getFileMD5(). Does not show how to transfer a file. |
example002.cpp | Download a single file with fc::Control::download() and uses fc::Control::getMostRecentFileStats() to display a large number of statistics on the file itself as well as the UDP transfer. |
example003.cpp | Very simple example of uploading a file using fc::Control::upload(). |
example004.cpp | Use a 2nd thread combined with fc::Control::getMostRecentFileStats() to display a simple progress indicator while the original thread completes a download using fc::Control::prepareSingleFile() and fc::Control::download(). |
example005.cpp | Retrieve a fc::FDVec (std::vector of fc::FileDetails) and display information on all the files on the remote server. |
example006.cpp | Use fc::Control::prepareRecursiveDir() to download a set of file and subdirectories, then upload the same set to a new location. Statistics on all the transferred files are displayed using fc::TransferStats::getStr(). |
example007.cpp | Use the callback hook fc::Control::setStatsCallback() to get a statistics callback every second during a transfer. |