本文整理汇总了C++中command函数的典型用法代码示例。如果您正苦于以下问题:C++ command函数的具体用法?C++ command怎么用?C++ command使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了command函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: command
void Max_LCD::noAutoscroll(void) {
_displaymode &= ~LCD_ENTRYSHIFTINCREMENT;
command(LCD_ENTRYMODESET | _displaymode);
}
开发者ID:16chuang,项目名称:Bluestamp-2014,代码行数:4,代码来源:max_LCD.cpp
示例2: command
/********** high level commands, for the user! */
void LiquidCrystal_I2C::clear(){
command(LCD_CLEARDISPLAY);// clear display, set cursor position to zero
delayMicroseconds(2000); // this command takes a long time!
}
开发者ID:Alexandrekmartins,项目名称:Arduino-LiquidCrystal-I2C-library,代码行数:5,代码来源:LiquidCrystal_I2C.cpp
示例3: command
void LiquidCrystalKtms::clear()
{
command(0x20); // clear display, set cursor position to zero
}
开发者ID:bluefix,项目名称:picsdr,代码行数:4,代码来源:LiquidCrystalKtms.cpp
示例4: command
// This is for text that flows Left to Right
void ControLeo_LiquidCrystal::leftToRight(void) {
_displaymode |= LCD_ENTRYLEFT;
command(LCD_ENTRYMODESET | _displaymode);
}
开发者ID:DickGrier,项目名称:ControLeo,代码行数:5,代码来源:ControLeo_LiquidCrystal.cpp
示例5: do_file
/* This runs the 'file' command. */
char *
do_file (const char *path)
{
CLEANUP_FREE char *buf = NULL;
const char *display_path = path;
int is_dev = STRPREFIX (path, "/dev/");
if (!is_dev) {
buf = sysroot_path (path);
if (!buf) {
reply_with_perror ("malloc");
return NULL;
}
path = buf;
/* For non-dev, check this is a regular file, else just return the
* file type as a string (RHBZ#582484).
*/
struct stat statbuf;
if (lstat (path, &statbuf) == -1) {
reply_with_perror ("lstat: %s", display_path);
return NULL;
}
if (! S_ISREG (statbuf.st_mode)) {
char *ret;
if (S_ISDIR (statbuf.st_mode))
ret = strdup ("directory");
else if (S_ISCHR (statbuf.st_mode))
ret = strdup ("character device");
else if (S_ISBLK (statbuf.st_mode))
ret = strdup ("block device");
else if (S_ISFIFO (statbuf.st_mode))
ret = strdup ("FIFO");
else if (S_ISLNK (statbuf.st_mode))
ret = strdup ("symbolic link");
else if (S_ISSOCK (statbuf.st_mode))
ret = strdup ("socket");
else
ret = strdup ("unknown, not regular file");
if (ret == NULL)
reply_with_perror ("strdup");
return ret;
}
}
/* Which flags to use? For /dev paths, follow links because
* /dev/VG/LV is a symbolic link.
*/
const char *flags = is_dev ? "-zbsL" : "-zb";
char *out;
CLEANUP_FREE char *err = NULL;
int r = command (&out, &err, str_file, flags, path, NULL);
if (r == -1) {
free (out);
reply_with_error ("%s: %s", display_path, err);
return NULL;
}
/* We need to remove the trailing \n from output of file(1). */
size_t len = strlen (out);
if (len > 0 && out[len-1] == '\n')
out[--len] = '\0';
/* Some upstream versions of file add a space at the end of the
* output. This is fixed in the Fedora version, but we might as
* well fix it here too. (RHBZ#928995).
*/
if (len > 0 && out[len-1] == ' ')
out[--len] = '\0';
return out; /* caller frees */
}
开发者ID:FengYang,项目名称:libguestfs,代码行数:79,代码来源:file.c
示例6: HELP
void DOS_Shell::CMD_SUBST (char * args) {
/* If more that one type can be substed think of something else
* E.g. make basedir member dos_drive instead of localdrive
*/
HELP("SUBST");
localDrive* ldp=0;
char mountstring[DOS_PATHLENGTH+CROSS_LEN+20];
char temp_str[2] = { 0,0 };
try {
strcpy(mountstring,"MOUNT ");
StripSpaces(args);
std::string arg;
CommandLine command(0,args);
if (command.GetCount() != 2) throw 0 ;
command.FindCommand(1,arg);
if( (arg.size()>1) && arg[1] !=':') throw(0);
temp_str[0]=(char)toupper(args[0]);
command.FindCommand(2,arg);
if((arg=="/D") || (arg=="/d")) {
if(!Drives[temp_str[0]-'A'] ) throw 1; //targetdrive not in use
strcat(mountstring,"-u ");
strcat(mountstring,temp_str);
this->ParseLine(mountstring);
return;
}
if(Drives[temp_str[0]-'A'] ) throw 0; //targetdrive in use
strcat(mountstring,temp_str);
strcat(mountstring," ");
Bit8u drive;char dir[DOS_PATHLENGTH+2],fulldir[DOS_PATHLENGTH];
if (strchr(arg.c_str(),'\"')==NULL)
sprintf(dir,"\"%s\"",arg.c_str());
else strcpy(dir,arg.c_str());
if (!DOS_MakeName(dir,fulldir,&drive)) throw 0;
if( ( ldp=dynamic_cast<localDrive*>(Drives[drive])) == 0 ) throw 0;
char newname[CROSS_LEN];
strcpy(newname, ldp->basedir);
strcat(newname,fulldir);
CROSS_FILENAME(newname);
ldp->dirCache.ExpandName(newname);
strcat(mountstring,"\"");
strcat(mountstring, newname);
strcat(mountstring,"\"");
this->ParseLine(mountstring);
}
catch(int a){
if(a == 0) {
WriteOut(MSG_Get("SHELL_CMD_SUBST_FAILURE"));
} else {
WriteOut(MSG_Get("SHELL_CMD_SUBST_NO_REMOVE"));
}
return;
}
catch(...) { //dynamic cast failed =>so no localdrive
WriteOut(MSG_Get("SHELL_CMD_SUBST_FAILURE"));
return;
}
return;
}
开发者ID:libretro,项目名称:dosbox-libretro,代码行数:63,代码来源:shell_cmds.cpp
示例7: command
// Turn on and off the blinking cursor
void LiquidCrystalRus::noBlink() {
_displaycontrol &= ~LCD_BLINKON;
command(LCD_DISPLAYCONTROL | _displaycontrol);
}
开发者ID:02047788a,项目名称:Marlin,代码行数:5,代码来源:LiquidCrystalRus.cpp
示例8: main
int main (int argc, char *argv[])
{
struct sockaddr_in s_in;
int c;
int pargc;
char **pargv;
while ((c = getopt (argc, argv, "Vv")) != -1)
{
switch (c)
{
case 'v':
verbose = 1;
break;
case 'V':
/* Print version and configuration to stdout and exit */
printf ("%s\n", TFTP_CONFIG_STR);
exit (0);
default:
fprintf (stderr, "Usage: %s [-v] [host]\n", argv[0]);
exit (EX_USAGE);
}
}
pargc = argc - (optind - 1);
pargv = argv + (optind - 1);
sp = getservbyname ("tftp", "udp");
if (sp == 0)
{
/* Use canned values */
fprintf (stderr, "tftp: tftp/udp: unknown service, faking it...\n");
sp = xmalloc (sizeof (struct servent));
sp->s_name = (char *) "tftp";
sp->s_aliases = NULL;
sp->s_port = htons (IPPORT_TFTP);
sp->s_proto = (char *) "udp";
exit (1);
}
f = socket (AF_INET, SOCK_DGRAM, 0);
if (f < 0)
{
perror ("tftp: socket");
exit (3);
}
bzero ((char *) &s_in, sizeof (s_in));
s_in.sin_family = AF_INET;
if (bind (f, (struct sockaddr *) &s_in, sizeof (s_in)) < 0)
{
perror ("tftp: bind");
exit (1);
}
mode = MODE_DEFAULT;
bsd_signal (SIGINT, intr);
if (pargc > 1)
{
if (sigsetjmp (toplevel, 1) != 0)
exit (0);
setpeer (pargc, pargv);
}
if (sigsetjmp (toplevel, 1) != 0)
(void) putchar ('\n');
#ifdef WITH_READLINE
#ifdef HAVE_READLINE_HISTORY_H
using_history ();
#endif
#endif
command ();
return 0; /* Never reached */
}
开发者ID:274914765,项目名称:C,代码行数:76,代码来源:main.c
示例9: main
int main( int argc, char ** argv )
{
// Checks that all required arguments are passed
if( argc < 4 )
{
vgLogMessage( "Missing arguments. Usage :" );
showUsage( "blowfish" /*argv[0]*/ );
return 0;
}
// Gets all arguments
std::string command( argv[1] );
std::vector< char > key;
boost::filesystem::path inPath;
boost::filesystem::path outPath;
key.resize( strlen(argv[2]) );
std::copy( argv[2], argv[2]+key.size(), key.begin() );
inPath = boost::filesystem::path( argv[3] );
if( !boost::filesystem::exists(inPath) )
{
vgLogMessage( "Invalid input path ", inPath.string().c_str() );
return 0;
}
if( argc > 4 )
{
outPath = boost::filesystem::path( argv[4] );
}
// Process the command.
if( command == "encrypt" )
{
if( outPath.empty() )
{
outPath = vgPhysfs::getEncryptedPath( inPath );
}
std::ifstream in( inPath.string().c_str(), std::ios::binary );
std::vector< char > inBuffer;
std::ofstream out( outPath.string().c_str(), std::ios::binary|std::ios::trunc );
in.seekg( 0, std::ios::end );
inBuffer.resize( in.tellg() );
in.seekg( 0, std::ios::beg );
in.read( &inBuffer[0], inBuffer.size() );
vgPhysfs::encrypt( key, inBuffer, out );
}
else if( command == "decrypt" )
{
if( outPath.empty() )
{
outPath = inPath;
if( vgPhysfs::isEncryptedPath(outPath) )
{
outPath.replace_extension();
}
else
{
outPath = outPath.string() + ".decrypted";
}
}
// Opens the stream and checks if it contains crypted data.
std::ifstream in( inPath.string().c_str(), std::ios::binary );
if( ! vgPhysfs::isEncrypted(in) )
{
vgLogMessage( "Source file does not contain valid crypted data." );
return 0;
}
// Decrypts and store clear data.
std::vector< char > inBuffer;
std::vector< char > outBuffer;
if( vgPhysfs::decrypt(key, in, inBuffer, outBuffer) )
{
std::ofstream out( outPath.string().c_str(), std::ios::binary|std::ios::trunc );
out.write( &outBuffer[0], outBuffer.size() );
}
}
else
{
vgLogMessage( "Unknown command." );
showUsage( "blowfish" /*argv[0]*/ );
}
return 0;
}
开发者ID:npapier,项目名称:vgsdk,代码行数:95,代码来源:main.cpp
示例10: switch
char *v25ter_input_encap(int c)
{
static char prev_cmd[CMDSIZE];
static char cmd[CMDSIZE];
static char *cmd_p;
/*
* A command line is made up of three elements: the prefix, the body,
* and the terminate character.
*/
switch (state_encap) {
case V25TER_STATE_NONE:
/* "AT" or "at" or "A/" or "a/" */
if (toupper(c) == 'A')
state_encap = V25TER_STATE_PREFIX;
break;
case V25TER_STATE_PREFIX:
if (c == '/') {
/* "A/" or "a/" */
/* Repeat the execution of the previous command line. */
state_encap = V25TER_STATE_NONE;
return command(prev_cmd);
} else if (toupper(c) == 'T') {
/* "AT" or "at" */
cmd_p = cmd;
state_encap = V25TER_STATE_BODY;
} else {
state_encap = V25TER_STATE_NONE;
}
break;
case V25TER_STATE_BODY:
if (c == '\r') {
/* the termination character */
/* EOS */
*cmd_p = '\0';
/* Save the command line. */
strcpy(prev_cmd, cmd);
/* Execute the command line. */
state_encap = V25TER_STATE_NONE;
return command(cmd);
} else {
if (c == '\b') {
/* the command line editing character */
if (cmd_p != cmd) {
/* Decrement pointer. */
cmd_p--;
}
} else {
if (cmd_p < cmd + CMDSIZE - 1) {
/* Save the command character. */
*cmd_p++ = c;
}
}
}
break;
default:
break;
}
return 0;
}
开发者ID:tyoshid,项目名称:libopenstm32l1,代码行数:64,代码来源:v25ter.c
示例11: command
void tcGameOutcomePopup::ExitGame(wxCommandEvent& event)
{
wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_ENDGAME);
AddPendingEvent(command);
}
开发者ID:WarfareCode,项目名称:gcblue,代码行数:5,代码来源:tcGameOutcomePopup.cpp
示例12: delayMicroseconds
void LiquidCrystalRus::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
if (lines > 1) {
_displayfunction |= LCD_2LINE;
}
_numlines = lines;
_currline = 0;
// for some 1 line displays you can select a 10 pixel high font
if ((dotsize != 0) && (lines == 1)) {
_displayfunction |= LCD_5x10DOTS;
}
// SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
// according to datasheet, we need at least 40ms after power rises above 2.7V
// before sending commands. Arduino can turn on way before 4.5V so we'll wait 50
delayMicroseconds(50000);
// Now we pull both RS and R/W low to begin commands
digitalWrite(_rs_pin, LOW);
digitalWrite(_enable_pin, LOW);
if (_rw_pin != 255) {
digitalWrite(_rw_pin, LOW);
}
//put the LCD into 4 bit or 8 bit mode
if (! (_displayfunction & LCD_8BITMODE)) {
// this is according to the Hitachi HD44780 datasheet
// figure 24, pg 46
// we start in 8bit mode, try to set 4 bit mode
writeNbits(0x03,4);
delayMicroseconds(4500); // wait min 4.1ms
// second try
writeNbits(0x03,4);
delayMicroseconds(4500); // wait min 4.1ms
// third go!
writeNbits(0x03,4);
delayMicroseconds(150);
// finally, set to 8-bit interface
writeNbits(0x02,4);
} else {
// this is according to the Hitachi HD44780 datasheet
// page 45 figure 23
// Send function set command sequence
command(LCD_FUNCTIONSET | _displayfunction);
delayMicroseconds(4500); // wait more than 4.1ms
// second try
command(LCD_FUNCTIONSET | _displayfunction);
delayMicroseconds(150);
// third go
command(LCD_FUNCTIONSET | _displayfunction);
}
// finally, set # lines, font size, etc.
command(LCD_FUNCTIONSET | _displayfunction);
// turn the display on with no cursor or blinking default
_displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
display();
// clear it off
clear();
// Initialize to default text direction (for romance languages)
_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
// set the entry mode
command(LCD_ENTRYMODESET | _displaymode);
}
开发者ID:02047788a,项目名称:Marlin,代码行数:74,代码来源:LiquidCrystalRus.cpp
注:本文中的command函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论