pvAccessCPP
7.1.9
Toggle main menu visibility
Loading...
Searching...
No Matches
Simple Client Put Example
The shortest possible PVA put() example.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
// The simplest possible PVA put
#include <
iostream
>
#include "pva/client.h"
int
main(
int
argc,
char
*argv[])
{
try
{
if
(argc<=2) {
std::cerr
<<
"Usage: "
<<argv[0]<<
" <pvname> <value>\n"
;
return
1;
}
pvac::ClientProvider
provider(
"pva"
);
pvac::ClientChannel
channel(provider.connect(argv[1]));
std::cout
<<
"Before "
<<channel.name()<<
" : "
<<channel.get()<<
"\n"
;
channel.put()
.set(
"value"
, argv[2])
.exec();
std::cout
<<
"After "
<<channel.name()<<
" : "
<<channel.get()<<
"\n"
;
}
catch
(
std::exception
& e){
std::cerr
<<
"Error: "
<<e.
what
()<<
"\n"
;
return
1;
}
}
iostream
std::cerr
ostream cerr
std::cout
ostream cout
std::exception
std::exception::what
virtual const char * what() const noexcept
pvac::ClientChannel
Represents a single channel.
Definition
client.h:267
pvac::ClientProvider
Central client context.
Definition
client.h:518
Generated on
for pvAccessCPP by
1.17.0