From b3f0017824d648ee2aaebcc051d7f669b94523a7 Mon Sep 17 00:00:00 2001 From: deniskovalchuk Date: Tue, 5 Sep 2023 01:33:52 +0300 Subject: [PATCH] Add 'Examples' section to README.md --- README.md | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 58ff54c..81390af 100644 --- a/README.md +++ b/README.md @@ -8,33 +8,13 @@ A cross-platform FTP client library based on Boost.Asio. -```c++ -#include -#include -#include - -int main(int argc, char *argv[]) -{ - ftp::client client; - - client.connect("ftp.freebsd.org", 21, "anonymous"); - - std::ostringstream oss; - - client.download_file(ftp::ostream_adapter(oss), "pub/FreeBSD/README.TXT"); - - std::cout << oss.str(); - - client.disconnect(); - - return 0; -} -``` +![Session Example](doc/session-example.png) ## Table of contents 1. [Overview](#overview) 1. [Features](#features) +1. [Examples](#examples) 1. [Prerequisites](#prerequisites) 1. [Build and Run](#build-and-run) 1. [Command-Line Client](#command-line-client) @@ -78,6 +58,31 @@ reverse conversion. - Supports active and passive transfer modes. - Supports ASCII and binary transfer types. +## Examples + +```c++ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + ftp::client client; + + client.connect("ftp.freebsd.org", 21, "anonymous"); + + std::ostringstream oss; + + client.download_file(ftp::ostream_adapter(oss), "pub/FreeBSD/README.TXT"); + + std::cout << oss.str(); + + client.disconnect(); + + return 0; +} +``` + ## Prerequisites - A C++17-compliant compiler @@ -136,8 +141,6 @@ ctest -V ## Command-Line Client -![Session Example](doc/session-example.png) - The supplied command-line client supports the following commands: 1. open hostname [ port ] - connect to ftp server