本文整理汇总了C++中put函数的典型用法代码示例。如果您正苦于以下问题:C++ put函数的具体用法?C++ put怎么用?C++ put使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sprintf
void buffer::put(int n)
{
char s[100];
sprintf(s, "%d", n);
put(s, strlen(s));
}
开发者ID:BertiniM2,项目名称:M2,代码行数:6,代码来源:buffer.cpp
示例2: print
void
print(struct termios *tp, struct winsize *wp, int ldisc, enum FMT fmt)
{
struct cchar *p;
long tmp;
u_char *cc;
int cnt, ispeed, ospeed;
char buf1[100], buf2[100];
cnt = 0;
/* Line discipline. */
if (ldisc != TTYDISC) {
switch(ldisc) {
case SLIPDISC:
cnt += printf("slip disc; ");
break;
case PPPDISC:
cnt += printf("ppp disc; ");
break;
default:
cnt += printf("#%d disc; ", ldisc);
break;
}
}
/* Line speed. */
ispeed = cfgetispeed(tp);
ospeed = cfgetospeed(tp);
if (ispeed != ospeed)
cnt +=
printf("ispeed %d baud; ospeed %d baud;", ispeed, ospeed);
else
cnt += printf("speed %d baud;", ispeed);
if (fmt >= BSD)
cnt += printf(" %d rows; %d columns;", wp->ws_row, wp->ws_col);
if (cnt)
(void)printf("\n");
#define on(f) ((tmp & (f)) != 0)
#define put(n, f, d) \
if (fmt >= BSD || on(f) != (d)) \
bput((n) + on(f));
/* "local" flags */
tmp = tp->c_lflag;
binit("lflags");
put("-icanon", ICANON, 1);
put("-isig", ISIG, 1);
put("-iexten", IEXTEN, 1);
put("-echo", ECHO, 1);
put("-echoe", ECHOE, 0);
put("-echok", ECHOK, 0);
put("-echoke", ECHOKE, 0);
put("-echonl", ECHONL, 0);
put("-echoctl", ECHOCTL, 0);
put("-echoprt", ECHOPRT, 0);
put("-altwerase", ALTWERASE, 0);
put("-noflsh", NOFLSH, 0);
put("-tostop", TOSTOP, 0);
put("-flusho", FLUSHO, 0);
put("-pendin", PENDIN, 0);
put("-nokerninfo", NOKERNINFO, 0);
put("-extproc", EXTPROC, 0);
/* input flags */
tmp = tp->c_iflag;
binit("iflags");
put("-istrip", ISTRIP, 0);
put("-icrnl", ICRNL, 1);
put("-inlcr", INLCR, 0);
put("-igncr", IGNCR, 0);
put("-ixon", IXON, 1);
put("-ixoff", IXOFF, 0);
put("-ixany", IXANY, 1);
put("-imaxbel", IMAXBEL, 1);
put("-ignbrk", IGNBRK, 0);
put("-brkint", BRKINT, 1);
put("-inpck", INPCK, 0);
put("-ignpar", IGNPAR, 0);
put("-parmrk", PARMRK, 0);
/* output flags */
tmp = tp->c_oflag;
binit("oflags");
put("-opost", OPOST, 1);
put("-onlcr", ONLCR, 1);
put("-ocrnl", OCRNL, 0);
switch(tmp&TABDLY) {
case TAB0:
bput("tab0");
break;
case TAB3:
bput("tab3");
break;
}
put("-onocr", ONOCR, 0);
put("-onlret", ONLRET, 0);
/* control flags (hardware state) */
//.........这里部分代码省略.........
开发者ID:0xbda2d2f8,项目名称:freebsd,代码行数:101,代码来源:print.c
示例3: put
void NCASink::put(const GroebnerRule& x) {
put(x.LHS());
d_ofs << " -> ";
put(x.RHS());
};
开发者ID:lolmid,项目名称:2015-2016,代码行数:5,代码来源:NCASink.c
示例4: put
/**
* Perform a PUT request.
*
* @param[in] request The request including the URI and headers.
* @param[in] callback If provided, the function to call for parts of the
* response's body as they come in.
* @param[in] body_generator The function to call to generate part of the body
* while the request is being performed.
* @returns A response object.
* @throws std::exception May throw exceptions derived from std::exception in
* case of errors.
*/
response put(request const& request, body_callback_function_type callback,
body_generator_function_type body_generator =
body_generator_function_type()) {
return put(request, string_type(), string_type(), callback, body_generator);
}
开发者ID:Coldrain,项目名称:cpp-netlib,代码行数:17,代码来源:facade.hpp
示例5: handle_req
void* handle_req(void* p)
{
conn_t * pConn = (conn_t*)p;
// Network state
// FIXME cuda_bridge_request_t == cuda_packet_t == rpkt_t, this is rediculous
strm_hdr_t *hdr = NULL;
rpkt_t *rpkts = NULL; // array of cuda packets
// CLOSE the listen connection
// conn_close(pConnListen);
// Connection-related structures
hdr = &pConn->strm.hdr;
rpkts = pConn->strm.rpkts; // an array of packets (MAX_REMOTE_BATCH_SIZE)
// these are buffers for extra data transferred as
pConn->pReqBuffer = NULL;
pConn->pRspBuffer = NULL;
while(1) {
p_debug("------------------New RPC--------------------\n");
memset(hdr, 0, sizeof(strm_hdr_t));
memset(rpkts, 0, MAX_REMOTE_BATCH_SIZE * sizeof(rpkt_t));
pConn->request_data_size = 0;
pConn->response_data_size = 0;
pConn->pReqBuffer = freeBuffer(pConn->pReqBuffer);
pConn->pRspBuffer = freeBuffer(pConn->pRspBuffer);
//recv the header describing the batch of remote requests
if (1 != get(pConn, hdr, sizeof(strm_hdr_t))) {
break;
}
p_debug(" received request header. Expecting %d packets. And extra request buffer of data size %d\n",
hdr->num_cuda_pkts, hdr->data_size);
if (hdr->num_cuda_pkts <= 0) {
p_warn("Received header specifying zero packets, ignoring\n");
continue;
}
// Receive the entire batch.
// first the packets, then the extra data (reqbuf)
//
// let's assume that we have enough space. otherwise we have a problem
// pConn allocates the buffers for incoming cuda packets
// so we should be fine
if(1 != get(pConn, rpkts, hdr->num_cuda_pkts * sizeof(rpkt_t))) {
break;
}
p_info("Received %d packets, each of size of (%lu) bytes\n",
hdr->num_cuda_pkts, sizeof(rpkt_t));
p_info( "Received method %s (method_id %d) from Thr_id: %lu.\n",
methodIdToString(rpkts[0].method_id), rpkts[0].method_id, rpkts[0].thr_id);
// receiving the request buffer if any
if(hdr->data_size > 0){
p_info("Expecting data size/Buffer: %u, %d.\n",
hdr->data_size, pConn->request_data_size);
// let's assume that the expected amount of data will fit into
// the buffer we have (size of pConn->request_data_buffer
// allocate the right amount of memory for the request buffer
pConn->pReqBuffer = malloc(hdr->data_size);
if( mallocCheck(pConn->pReqBuffer, __FUNCTION__, NULL) == ERROR ){
break;
}
//assert(hdr->data_size <= TOTAL_XFER_MAX);
if(1 != get(pConn, pConn->pReqBuffer, hdr->data_size)){
pConn->pReqBuffer = freeBuffer(pConn->pReqBuffer);
break;
}
pConn->request_data_size = hdr->data_size;
p_info( "Received request buffer (%d bytes)\n", pConn->request_data_size);
}
// execute the request
pkt_execute(&rpkts[0], pConn);
// we need to send the one response packet + response_buffer if any
// @todo you need to check if he method needs to send
// and extended response - you need to provide the right
// data_size
if( strm_expects_response(&pConn->strm) ){
// send the header about response
p_debug( "pConn->response_data_size %d\n", pConn->response_data_size);
if (conn_sendCudaPktHdr(&*pConn, 1, pConn->response_data_size) == ERROR) {
p_info( "__ERROR__ after : Sending the CUDA packet response header: Quitting ... \n");
break;
}
// send the standard response (with cuda_error_t, and simple arguments etc)
if (1 != put(pConn, rpkts, sizeof(rpkt_t))) {
//.........这里部分代码省略.........
开发者ID:dipanjans12,项目名称:GVirt,代码行数:101,代码来源:backend_back.c
示例6: put
void ConfigParam::configTraceList(string s) {
put(CONFIG_PARAM_TRACE_LIST, s);
}
开发者ID:ShichangXu,项目名称:PACO,代码行数:3,代码来源:config_param.cpp
示例7: main
//.........这里部分代码省略.........
printf("connect server fail\n");
return -1;
}
else
{
printf("connect server succeed\n");
}
printf("***connected server %s port: %u***\n",str,port);
buff = (unsigned char *)malloc(MEMSIZE); //分配一个堆区域,用于socket通信存储信息
assert (buff != NULL);
printf("Whether the anonymous login(yes or no):"); //是否匿名登录
memset(buff,0,sizeof(char)*MEMSIZE);
scanf("%s",buff);
if (strcmp(buff,"yes")) //如果不匿名登录,则执行下列语句
{
send(sk,"no_anonymous",strlen("no_anonymous"),0); //告诉客户端不匿名登录
for (err=0; err<3; err++) // 客户端有三次登录验证的机会
{
if (!login(sk,buff))
break;
printf("\nlogin incorrect\n\n");
}
if ( 3 == err)
{
printf("more than 3 times,client exit\n");
return -1;
}
}
else
{
send(sk,"anonymous",strlen("anonymous"),0); //匿名登录
if (!strcmp(buff,"no"))
{
printf("you don't say no,but i think the word is no\n");
printf("you will anonymous login,some command will can't execute\n");
}
}
sigsk = sk;
while (1)
{
memset(buff,0,MEMSIZE);
printf("FTP>");
scanf("%s",cmd);
strcpy(buff,cmd[0]);
strcpy(bufftail,cmd[1]);
switch(buff[0])
{
case 'l':
{
ls(buff,sk);
}
break;
case 'h':
{
help(buff);
}
break;
case 'p':
{
put(buff,sk,bufftail);
}
break;
case 'g':
{
get(buff,sk,bufftail);
}
break;
case 'q':
{
if ( !quit(buff,sk) )
goto END;
}
break;
case 'e':
{
if ( !quit(buff,sk) )
goto END;
}
break;
case 'c':
{
clear(buff);
}
break;
default :
{
printf("***Invalid command***\n");
}
break;
}
}
END:
return 0;
}
开发者ID:cinience,项目名称:practice-socket,代码行数:101,代码来源:ftpclient.c
示例8: put
int put(const char *str, int count=1) {
return put((AzByte *)str, Az64::cstrlen(str), count);
}
开发者ID:NavinManaswi,项目名称:RGF_Hadoop,代码行数:3,代码来源:AzStrPool.hpp
示例9: put
void put(int ith){
if (ith == n*n){
max = (max > count ? max : count);
return ;
}
int i, j;
for (i = ith; i < n*n; ++i){
int r = i / n ;
int c = i % n ;
if (board[r][c] == -1){
board[r][c] = i;
count++;
// mark
// up
for (j = r-1; j >= 0; j--){
if(board[j][c] == -2)
break;
else if (board[j][c] == -1)
board[j][c] = i;
}
// down
for (j = r + 1; j < n; ++j){
if(board[j][c] == -2)
break;
else if (board[j][c] == -1)
board[j][c] = i;
}
// left
for (j = c-1; j >= 0; j--){
if (board[r][j] == -2)
break;
else if (board[r][j] == -1)
board[r][j] = i;
}
// right
for (j = c + 1; j < n; ++j){
if (board[r][j] == -2)
break;
else if (board[r][j] == -1)
board[r][j] = i;
}
put(i + 1);
count--;
board[r][c] = -1;
// up
for (j = r-1; j >= 0; j--){
if(board[j][c] == -2)
break;
else if (board[j][c] == i)
board[j][c] = -1;
}
// down
for (j = r + 1; j < n; ++j){
if(board[j][c] == -2)
break;
else if (board[j][c] == i)
board[j][c] = -1;
}
// left
for (j = c-1; j >= 0; j--){
if (board[r][j] == -2)
break;
else if (board[r][j] == i)
board[r][j] = -1;
}
// right
for (j = c + 1; j < n; ++j){
if (board[r][j] == -2)
break;
else if (board[r][j] == i)
board[r][j] = -1;
}
} else {
put(i + 1);
}
}
}
开发者ID:lj102800,项目名称:IvanJobs,代码行数:87,代码来源:zoj1002.cpp
示例10: putv
inline int putv(const AzBytArr *bq, int value) {
int count = 1;
return put(bq->point(), bq->getLen(), count, value);
}
开发者ID:NavinManaswi,项目名称:RGF_Hadoop,代码行数:4,代码来源:AzStrPool.hpp
示例11: put
int ByteBuffer::putInt(int in){
byte *pointer = (byte *)∈
put(pointer[1]);
put(pointer[0]);
return in;
}
开发者ID:DomoYo08,项目名称:homewatch,代码行数:6,代码来源:ByteBuffer.cpp
示例12: letter
void letter(char l)
{
//int i;
switch (l)
{
case 'A':
put(0);
break;
case 'B':
put(5);
break;
case 'C':
put(10);
break;
case 'D':
put(15);
break;
case 'E':
put(20);
break;
case 'F':
put(25);
break;
case 'G':
put(30);
break;
case 'H':
put(35);
break;
case 'I':
put(40);
break;
case 'J':
put(45);
break;
case 'K':
put(50);
break;
case 'L':
put(55);
break;
case 'M':
put(60);
break;
case 'N':
put(65);
break;
case 'O':
put(70);
break;
case 'P':
put(75);
break;
case 'Q':
put(80);
break;
case 'R':
put(85);
break;
case 'S':
put(90);
break;
case 'T':
put(95);
break;
case 'U':
put(100);
break;
case 'V':
put(105);
break;
case 'W':
put(110);
break;
case 'X':
put(115);
break;
case 'Y':
put(120);
break;
case 'Z':
put(125);
break;
case ' ':
put(130);
break;
case '0':
put(135);
break;
case '1':
put(140);
break;
case '2':
put(145);
break;
case '3':
put(150);
break;
case '4':
put(155);
//.........这里部分代码省略.........
开发者ID:KoksuMichu,项目名称:GitHub,代码行数:101,代码来源:display.c
示例13: put
void TiObject::put(TiExcState* exec, unsigned propertyName, TiValue value)
{
PutPropertySlot slot;
put(exec, Identifier::from(exec, propertyName), value, slot);
}
开发者ID:rseagraves,项目名称:tijscore,代码行数:5,代码来源:TiObject.cpp
示例14: main
int main(int argc, char** argv)
{
put(argv[1], argv[2]);
return 0;
}
开发者ID:CanoeFZH,项目名称:pregelplus-code,代码行数:5,代码来源:put.cpp
示例15: putDescriptor
bool TiObject::defineOwnProperty(TiExcState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException)
{
// If we have a new property we can just put it on normally
PropertyDescriptor current;
if (!getOwnPropertyDescriptor(exec, propertyName, current))
return putDescriptor(exec, this, propertyName, descriptor, descriptor.attributes(), jsUndefined());
if (descriptor.isEmpty())
return true;
if (current.equalTo(descriptor))
return true;
// Filter out invalid changes
if (!current.configurable()) {
if (descriptor.configurable()) {
if (throwException)
throwError(exec, TypeError, "Attempting to configurable attribute of unconfigurable property.");
return false;
}
if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) {
if (throwException)
throwError(exec, TypeError, "Attempting to change enumerable attribute of unconfigurable property.");
return false;
}
}
// A generic descriptor is simply changing the attributes of an existing property
if (descriptor.isGenericDescriptor()) {
if (!current.attributesEqual(descriptor)) {
deleteProperty(exec, propertyName);
putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value());
}
return true;
}
// Changing between a normal property or an accessor property
if (descriptor.isDataDescriptor() != current.isDataDescriptor()) {
if (!current.configurable()) {
if (throwException)
throwError(exec, TypeError, "Attempting to change access mechanism for an unconfigurable property.");
return false;
}
deleteProperty(exec, propertyName);
return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value() ? current.value() : jsUndefined());
}
// Changing the value and attributes of an existing property
if (descriptor.isDataDescriptor()) {
if (!current.configurable()) {
if (!current.writable() && descriptor.writable()) {
if (throwException)
throwError(exec, TypeError, "Attempting to change writable attribute of unconfigurable property.");
return false;
}
if (!current.writable()) {
if (descriptor.value() || !TiValue::strictEqual(current.value(), descriptor.value())) {
if (throwException)
throwError(exec, TypeError, "Attempting to change value of a readonly property.");
return false;
}
}
} else if (current.attributesEqual(descriptor)) {
if (!descriptor.value())
return true;
PutPropertySlot slot;
put(exec, propertyName, descriptor.value(), slot);
if (exec->hadException())
return false;
return true;
}
deleteProperty(exec, propertyName);
return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value());
}
// Changing the accessor functions of an existing accessor property
ASSERT(descriptor.isAccessorDescriptor());
if (!current.configurable()) {
if (descriptor.setterPresent() && !(current.setter() && TiValue::strictEqual(current.setter(), descriptor.setter()))) {
if (throwException)
throwError(exec, TypeError, "Attempting to change the setter of an unconfigurable property.");
return false;
}
if (descriptor.getterPresent() && !(current.getter() && TiValue::strictEqual(current.getter(), descriptor.getter()))) {
if (throwException)
throwError(exec, TypeError, "Attempting to change the getter of an unconfigurable property.");
return false;
}
}
TiValue accessor = getDirect(propertyName);
if (!accessor)
return false;
GetterSetter* getterSetter = asGetterSetter(accessor);
if (current.attributesEqual(descriptor)) {
if (descriptor.setter())
getterSetter->setSetter(asObject(descriptor.setter()));
if (descriptor.getter())
getterSetter->setGetter(asObject(descriptor.getter()));
return true;
}
//.........这里部分代码省略.........
开发者ID:rseagraves,项目名称:tijscore,代码行数:101,代码来源:TiObject.cpp
示例16: main
int
main(void)
{
init();
#if 0
put(24, 24);
put(72, 72);
put(1, 1);
put(39, 39);
put(53, 53);
put(63, 63);
put(90, 90);
put(88, 88);
put(15, 15);
put(10, 10);
put(44, 44);
put(68, 68);
put(74, 74);
bplus_tree_dump(bplus_tree);
#endif
#if 0
put(10, 10);
put(15, 15);
put(18, 18);
put(22, 22);
put(27, 27);
put(34, 34);
put(40, 40);
put(44, 44);
put(47, 47);
put(54, 54);
put(67, 67);
put(72, 72);
put(74, 74);
put(78, 78);
put(81, 81);
put(84, 84);
bplus_tree_dump(bplus_tree);
#endif
#if 0
printf("key:24 data:%d\n", get(24));
printf("key:72 data:%d\n", get(72));
printf("key:01 data:%d\n", get(1));
printf("key:39 data:%d\n", get(39));
printf("key:53 data:%d\n", get(53));
printf("key:63 data:%d\n", get(63));
printf("key:90 data:%d\n", get(90));
printf("key:88 data:%d\n", get(88));
printf("key:15 data:%d\n", get(15));
printf("key:10 data:%d\n", get(10));
printf("key:44 data:%d\n", get(44));
printf("key:68 data:%d\n", get(68));
printf("key:74 data:%d\n", get(74));
printf("key:44 data:%d\n", get(44));
printf("key:45 data:%d\n", get(45));
printf("key:46 data:%d\n", get(46));
printf("key:47 data:%d\n", get(47));
printf("key:48 data:%d\n", get(48));
#endif
#if 0
put(90, 0);
bplus_tree_dump(bplus_tree);
put(88, 0);
bplus_tree_dump(bplus_tree);
put(74, 0);
bplus_tree_dump(bplus_tree);
put(72, 0);
bplus_tree_dump(bplus_tree);
put(68, 0);
bplus_tree_dump(bplus_tree);
put(63, 0);
bplus_tree_dump(bplus_tree);
put(53, 0);
bplus_tree_dump(bplus_tree);
put(44, 0);
bplus_tree_dump(bplus_tree);
put(39, 0);
bplus_tree_dump(bplus_tree);
put(24, 0);
bplus_tree_dump(bplus_tree);
put(15, 0);
bplus_tree_dump(bplus_tree);
put(10, 0);
bplus_tree_dump(bplus_tree);
put(1, 0);
bplus_tree_dump(bplus_tree);
#endif
#define MAX_KEY 100
int i;
for (i = 1; i <= MAX_KEY; i++) {
put(i, i);
}
bplus_tree_dump(bplus_tree);
while (--i > 0) {
put(i, 0);
}
bplus_tree_dump(bplus_tree);
for (i = MAX_KEY; i > 0; i--) {
put(i, i);
}
//.........这里部分代码省略.........
开发者ID:BonusTeam,项目名称:CodeHome,代码行数:101,代码来源:BplusTreeRank.c
示例17: put
void JSCell::putVirtual(ExecState* exec, const Identifier& identifier, JSValue value, PutPropertySlot& slot)
{
put(this, exec, identifier, value, slot);
}
开发者ID:1833183060,项目名称:wke,代码行数:4,代码来源:JSCell.cpp
示例18: put
bx_extfpuirq_c::bx_extfpuirq_c(void)
{
put("EFIRQ");
settype(EXTFPUIRQLOG);
}
开发者ID:hack477,项目名称:bochs4wii,代码行数:5,代码来源:extfpuirq.cpp
示例19: put
void buffer::put(const char *s) { put(s, strlen(s)); }
开发者ID:BertiniM2,项目名称:M2,代码行数:1,代码来源:buffer.cpp
注:本文中的put函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论