Visual C++ Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Visual C++ Examples

CkString
Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
DH Key Exchange
DKIM/DomainKeys
Digital Certificates
Digital Signatures
DSA
Email
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

 

 

FTP Upload with Progress Monitoring

Download Chilkat C/C++ Libraries for VC++ 10.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 10.0 / x64

Download Chilkat C/C++ Libraries for VC++ 9.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 9.0 / x64

Download Chilkat C/C++ Libraries for VC++ 8.0 / Win32

Download Chilkat C/C++ 64-bit Libraries for VC++ 8.0 / x64

Download Chilkat Visual Studio 2005 C/C++ Libs for Windows Mobile, Pocket PC, SmartPhone, WinCE

Download Chilkat C/C++ Libraries for VC++ 7.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0, Win 95/98/NT4 Compatible

C++ source code to FTP upload a file.

// To get FTP progress monitoring callbacks, declare a C++ class
// that inherits from the CkFtpProgress base class and provide
// implementations for FtpPercentDone and AbortCheck.

class MyFtpProgress : public CkFtpProgress
    {
    // pctDone is a percent value between 1 and 100.
    // FtpPercentDone is called each time pctDone increases.
    // The abort argument can be set to cause the FTP to abort while in progress.
    void FtpPercentDone(long pctDone, bool *abort) 
	{ 
	printf("%d Percent Done!\n",pctDone);

	// In this example, we will abort the transfer after it is 40% complete.
	//if (pctDone >= 40)
	    //{
	    //*abort = true;
	    //}
	}

    // Called periodically to check to see if the transfer should be aborted.
    void AbortCheck(bool *abort) 
	{ 
	printf("Abort Check!\n");

	// Set the *abort argument to true to force a transfer to abort.
	// For example:
	//*abort = true;
	}

    };

// Upload a file to an FTP server.
void FtpUpload(void)
    {
    CkFtp2 ftp;
    MyFtpProgress myProgress;

    ftp.UnlockComponent("anything for 30-day trial");

    ftp.put_Hostname("ftp.chilkatsoft.com");
    ftp.put_Username("****");
    ftp.put_Password("****");

    // non-passive (active) connections are most likely to work if firewalls are present.
    ftp.put_Passive(false);

    // The HeartbeatMs property controls the frequency of AbortCheck callbacks.
    // The default value is 0 (no callbacks).  Set it to a reasonable number of milliseconds:
    ftp.put_HeartbeatMs(250);

    // Set the SendBufferSize to a smaller value than the default of 512K to get more frequent callbacks:
    // This may slightly degrade performance.
    ftp.put_SendBufferSize(4096);

    bool success = ftp.Connect();
    if (!success)
	{
	ftp.SaveLastError("ftpLog.txt");
	return;
	}

    // Call PutFile2 to upload with progress monitoring.
    // Call PutFile to upload without progress monitoring.
    success = ftp.PutFile2("testUpload.dat","testUpload.dat",myProgress);
    if (!success)
	{
	ftp.SaveLastError("ftpLog.txt");
	}

    ftp.Disconnect();

 

 

 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Mail Component · XML Parser