EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Writing the data to the end of the file.

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#7140
Posted: 07/30/2008 12:06:42
by Andrei Garine (Standard support level)
Joined: 07/21/2008
Posts: 7

Hi,
I need to write the data to the end of the file.
Here is my code.

string data = “my data”;
byte[] fileHandle;
if (SftpClient.FileExists(AbsPath(Path.Combine(path, destFileName))))
fileHandle = SftpClient.OpenFile(AbsPath(Path.Combine(path, destFileName)), SBSftpCommon.Unit.fmWrite | SBSftpCommon.Unit.fmAppend, SBSftpCommon.Unit.faWriteLock, null);
else
fileHandle = SftpClient.CreateFile(AbsPath(Path.Combine(path, destFileName)));
SftpClient.Write(fileHandle, offSet, ASCIIEncoding.UTF8.GetBytes(data));
SftpClient.CloseHandle(fileHandle);

Question: how can I know the value of offSet?
Or I need to use the other method?
#7141
Posted: 07/30/2008 12:28:35
by Ken Ivanov (EldoS Corp.)

The needed offset can be obtained from the file attributes (that, in turn, can be obtained using RequestAttributes() method).

However, all these methods are low-level ones. If TElSimpleSFTPClient is the component you are using, please consider using UploadFile()/UploadStream() method, passing the appropriate mode flag to it.

Reply

Statistics

Topic viewed 1054 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!