Print

Print


(I don't know how to attach a source file in github):

#include
#include
#include
#include
#include
#include
#include

int main()
{
XrdClient *xrd = new XrdClient("root://xroot.example.com//path/non_empty_file");

if (!xrd) {
fprintf(stderr, "Could not make an XrdClient\n");
return 1;
}

bool bret = xrd->Open(0, kXR_open_read, false);

if (!bret) {
fprintf(stderr, "Could not open file\n");
return 1;
}

FILE *stream = popen("/bin/true", "r");

if (!stream) {
fprintf(stderr, "Could not popen\n");
return 1;
}

pclose(stream);

int rlen = 1;
long long off =0;
char buf[1];
int iret = xrd->Read(buf, off, rlen);

if (iret != 1) {
fprintf(stderr, "Unexpected return value from Read\n");
return 1;
}

xrd->Close();
delete xrd;

return 0;
}


Reply to this email directly or view it on GitHub.



Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1