Windows平台c++对ftp/sftp文件和文件夹上传工程源代码


Windows平台下c++ 对ftp和sftp文件以及文件夹下载上传整体的工程源代码。 内涵文档,测试用例 经过单元测试,集成测试 可靠,本人也是经过半个月的开发和封装
资源截图
代码片段和文件信息
/*
  Copyright (c) 2009 Dave Gamble

  Permission is hereby granted free of charge to any person obtaining a copy
  of this software and associated documentation files (the “Software“) to deal
  in the Software without restriction including without limitation the rights
  to use copy modify merge publish distribute sublicense and/or sell
  copies of the Software and to permit persons to whom the Software is
  furnished to do so subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
  IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
  LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/

/* cJSON */
/* JSON parser in C. */
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include “cJSON.h“

static const char *ep;

const char *cJSON_GetErrorPtr(void) {return ep;}

static int cJSON_strcasecmp(const char *s1const char *s2)
{
if (!s1) return (s1==s2)?0:1;if (!s2) return 1;
for(; tolower(*s1) == tolower(*s2); ++s1 ++s2) if(*s1 == 0) return 0;
return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
}

static void *(*cJSON_malloc)(size_t sz) = malloc;
static void (*cJSON_free)(void *ptr) = free;

static char* cJSON_strdup(const char* str)
{
      size_t len;
      char* copy;

      len = strlen(str) + 1;
      if (!(copy = (char*)cJSON_malloc(len))) return 0;
      memcpy(copystrlen);
      return copy;
}

void cJSON_InitHooks(cJSON_Hooks* hooks)
{
    if (!hooks) { /* Reset hooks */
        cJSON_malloc = malloc;
        cJSON_free = free;
        return;
    }

cJSON_malloc = (hooks->malloc_fn)?hooks->malloc_fn:malloc;
cJSON_free  = (hooks->free_fn)?hooks->free_fn:free;
}

/* Internal constructor. */
static cJSON *cJSON_New_Item(void)
{
cJSON* node = (cJSON*)cJSON_malloc(sizeof(cJSON));
if (node) memset(node0sizeof(cJSON));
return node;
}

/* Delete a cJSON structure. */
void cJSON_Delete(cJSON *c)
{
cJSON *next;
while (c)
{
next=c->next;
if (!(c->type&cJSON_IsReference) && c->child) cJSON_Delete(c->child);
if (!(c->type&cJSON_IsReference) && c->valuestring) cJSON_free(c->valuestring);
if (!(c->type&cJSON_StringIsConst) && c->string) cJSON_free(c->string);
cJSON_free(c);
c=next;
}
}

/* Parse the input text to generate a number and populate the result into item. */
static const char *parse_number(cJSON *itemconst char *num)
{
double n=0sign=1scale=0;int subscale=0signsubscale=1;

if (*num==‘-‘) sign=-1num++; /* Ha

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件         17  2018-05-02 14:17  ftp_sftp.gitCOMMIT_EDITMSG

     文件        296  2018-04-25 17:46  ftp_sftp.gitconfig

     文件         73  2018-04-25 17:46  ftp_sftp.gitdescription

     文件         23  2018-04-25 17:46  ftp_sftp.gitHEAD

     文件        478  2018-04-25 17:46  ftp_sftp.githooksapplypatch-msg.sample

     文件        896  2018-04-25 17:46  ftp_sftp.githookscommit-msg.sample

     文件        189  2018-04-25 17:46  ftp_sftp.githookspost-update.sample

     文件        424  2018-04-25 17:46  ftp_sftp.githookspre-applypatch.sample

     文件       1642  2018-04-25 17:46  ftp_sftp.githookspre-commit.sample

     文件       1348  2018-04-25 17:46  ftp_sftp.githookspre-push.sample

     文件       4951  2018-04-25 17:46  ftp_sftp.githookspre-rebase.sample

     文件        544  2018-04-25 17:46  ftp_sftp.githookspre-receive.sample

     文件       1239  2018-04-25 17:46  ftp_sftp.githooksprepare-commit-msg.sample

     文件       3610  2018-04-25 17:46  ftp_sftp.githooksupdate.sample

     文件       3539  2018-05-02 14:17  ftp_sftp.gitindex

     文件        240  2018-04-25 17:46  ftp_sftp.gitinfoexclude

     文件        695  2018-05-02 14:17  ftp_sftp.gitlogsHEAD

     文件        695  2018-05-02 14:17  ftp_sftp.gitlogs
efsheadsmaster

     文件        182  2018-04-25 17:46  ftp_sftp.gitlogs
efs
emotesoriginHEAD

     文件        453  2018-05-02 14:18  ftp_sftp.gitlogs
efs
emotesoriginmaster

     文件        112  2018-05-02 12:11  ftp_sftp.gitobjects251d04a8436ec76afcdcea517da2b034e89acb2

     文件        179  2018-05-02 14:17  ftp_sftp.gitobjectsa83d141329ca85281b7055ff894e647dbbf9360

     文件    2101020  2018-05-02 14:17  ftp_sftp.gitobjectsbcf97f955650e94eda32ee393e75859bf5680e

     文件         53  2018-05-02 12:11  ftp_sftp.gitobjects1685d3e70168cf09b20ac73a5664d73f57381bc2

     文件       5157  2018-04-25 17:50  ftp_sftp.gitobjects175bf6d99c2b91291aed8ddfe9609b9938b77e85

     文件        536  2018-05-02 14:17  ftp_sftp.gitobjects1b36eb69eba4959d91fa17374a10c6905df9f37a

     文件        443  2018-04-25 17:50  ftp_sftp.gitobjects2064df95098a5a664faa9c2f637507a536b894c3

     文件        441  2018-04-25 17:50  ftp_sftp.gitobjects2d7d3fdadb190a2f789a85172c9e2eb83a33cf28

     文件        216  2018-05-02 12:11  ftp_sftp.gitobjects2df25c5a072937a54c6f6c1ce4cd0f09e4250a8d

     文件        873  2018-04-25 17:50  ftp_sftp.gitobjects30851259a0ea04aa6dc5b95fd30bdd4d943cc4bf

............此处省略183个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)