Archived Forum Post

Index of archived forum posts

Question:

SFTP WriteFileText access violation

Aug 13 '13 at 02:30

I try to use SFTP upload with embedded data, with WriteFileBytes. The byte data is extracted from a embedded ZIP.

This causes an access violation, so I tried WriteFileText, same result. The file is transferred completly.

It is always a read access violation, always the same address (depending on compiler): 0x00000028 at visual c++ 0x00000024 at borland c++

I have tried C++ and C API with Borland. For Visual C++ I only made a quick test with C:

HCkSFtp sftp; const char* handle;

sftp = CkSFtp_Create();

CkSFtp_UnlockComponent(sftp, "MY_PURCHASED_KEY");

if (CkSFtp_Connect(sftp, "192.168.56.2", 22))
{
    do
    {
        if (!CkSFtp_AuthenticatePw(sftp, "root", "whatever"))
            break;

        if (!CkSFtp_InitializeSftp(sftp))
            break;

        handle = CkSFtp_openFile(sftp, "/root/test.txt", "writeOnly", "createTruncate");

        if (handle)
        {
            CkSFtp_WriteFileText(sftp, handle, "ansi", "test\n"); // -> Trap!
            CkSFtp_CloseHandle(sftp, handle);
        }
    }
    while (0);

    CkSFtp_Disconnect(sftp);
}

CkSFtp_Dispose(sftp);

I have downloaded the latest version (9.4.1), Server is linux with openssh, client is windows 7 64-bit, application is always 32 bit.


Accepted Answer

Here's a new build for you to test: http://www.chilkatsoft.com/preRelease/chilkat-9.4.1-bcc-xe2.zip


Answer

Thanks! I found and fixed the problem. What new builds do you need? (VC++ versions?, Borland C++?, ec.)


Answer

I use RAD2010, the XE2 C++ build works pretty well for me. Thanks for your quick reply


Answer

Works, thank you.