EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Writing the data to the end of the file.

Posted: 07/30/2008 12:06:42
by Andrei Garine (Standard support level)
Joined: 07/21/2008
Posts: 7

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);
fileHandle = SftpClient.CreateFile(AbsPath(Path.Combine(path, destFileName)));
SftpClient.Write(fileHandle, offSet, ASCIIEncoding.UTF8.GetBytes(data));

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

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.



Topic viewed 1176 times

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


Back to top

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

Got it!