ultimatepp/reference/SshBasics/SFtpStream.cpp
oblivion eb8b93826b SshBasics (a reference example set for the SSH package) is added, and SFtpGet & SshExec examples are removed.
git-svn-id: svn://ultimatepp.org/upp/trunk@12171 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2018-08-17 20:14:36 +00:00

21 lines
No EOL
449 B
C++

#include "SshBasics.h"
// SFtpStreamGet:
// Demonstrates a basic stream operation on an sftp remote file object.
void SFtpStreamGet(SshSession& session)
{
const char *path = "/readme.txt";
SFtp sftp(session);
SFtpFileIn fi(sftp, path);
while(!fi.IsEof()) {
int64 pos = fi.GetPos();
String line = fi.GetLine();
if(!line.IsEmpty())
LOG(Format("Offset: %3d, Line: [%s]", pos, line));
}
if(fi.IsError())
LOG(fi.GetErrorText());
}