本文整理汇总了C++中printv函数的典型用法代码示例。如果您正苦于以下问题:C++ printv函数的具体用法?C++ printv怎么用?C++ printv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printv函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: v4l_suspend
static int
v4l_suspend(vbi_capture_v4l *v)
{
int fd;
v4l_read_stop(v);
if (v->read_active) {
printv("Suspending read: re-open device...\n");
/* hack: cannot suspend read to allow SVBIFMT,
need to close device */
fd = device_open (v->capture.sys_log_fp,
v->p_dev_name, O_RDWR, 0);
if (-1 == fd) {
printv ("v4l2-suspend: failed to re-open "
"VBI device: %d: %s\n",
errno, strerror(errno));
return -1;
}
/* use dup2() to keep the same fd,
which may be used by our client */
device_close (v->capture.sys_log_fp, v->fd);
dup2 (fd, v->fd);
device_close (v->capture.sys_log_fp, fd);
v->read_active = FALSE;
}
return 0;
}
开发者ID:nagyistoce,项目名称:canalplus-r7oss,代码行数:31,代码来源:io-v4l.c
示例2: main
int main()
try{
//input
std::cout << "Input a string: ";
std::string s;
std::getline(std::cin, s);
if (!std::cin){
throw std::runtime_error("input fail");
}
std::string w;
std::cout << "Input whitespace: ";
std::getline(std::cin, w);
if (!std::cin){
throw std::runtime_error("input fail");
}
//output
std::cout << "split:" << std::endl;
printv(split(s));
std::cout << "split (with w):" << std::endl;
printv(split(s, w));
return 0;
}
catch (std::runtime_error& e){
std::cerr << "Error: " << e.what() << std::endl;
return 1;
}
catch (...){
std::cerr << "Unknown error!" << std::endl;
return 2;
}
开发者ID:codeworm96,项目名称:SE105-Programming-1,代码行数:30,代码来源:ex4.cpp
示例3: check_copied_tags
void check_copied_tags(struct radix_tree_root *tree, unsigned long start, unsigned long end, unsigned long *idx, int count, int fromtag, int totag)
{
int i;
for (i = 0; i < count; i++) {
/* if (i % 1000 == 0)
putchar('.'); */
if (idx[i] < start || idx[i] > end) {
if (item_tag_get(tree, idx[i], totag)) {
printv(2, "%lu-%lu: %lu, tags %d-%d\n", start,
end, idx[i], item_tag_get(tree, idx[i],
fromtag),
item_tag_get(tree, idx[i], totag));
}
assert(!item_tag_get(tree, idx[i], totag));
continue;
}
if (item_tag_get(tree, idx[i], fromtag) ^
item_tag_get(tree, idx[i], totag)) {
printv(2, "%lu-%lu: %lu, tags %d-%d\n", start, end,
idx[i], item_tag_get(tree, idx[i], fromtag),
item_tag_get(tree, idx[i], totag));
}
assert(!(item_tag_get(tree, idx[i], fromtag) ^
item_tag_get(tree, idx[i], totag)));
}
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:27,代码来源:main.c
示例4: print
void print(int num[],int total,int s){
int c,r;
int i,j,k;
c = 2*s; r = 2*s+3;
for(i=0;i<r;i++){
for(j=total-1;j>=0;j--){
if(i==0||i==s+1||i==2*s+2){
if(i==0)
print_horizon(num[j],0,s);
else if(i==s+1)
print_horizon(num[j],3,s);
else
print_horizon(num[j],6,s);
} else {
if(i-s<=0.0){
printv(num[j],1,2,s);
}else {
printv(num[j],4,5,s);
}
}
if(j!=0)printf(" ");
}
printf("\n");
}
}
开发者ID:waitin2010,项目名称:Algorithm,代码行数:25,代码来源:706.c
示例5: pair_print
inline void pair_print( container *C, value v )
{
printf("(");
printv(((pair_container_priv*)C->priv)->A, pair(v).first);
printf(":");
printv(((pair_container_priv*)C->priv)->B, pair(v).second);
printf(")");
}
开发者ID:FlavioFalcao,项目名称:enterprise-search,代码行数:8,代码来源:dpair.c
示例6: main
int
main(int argc, char *argv[]) {
int arr[9] = {5,17,3,10,84,19,6,22,9};
int heap[5];
printv(arr, 9);
k_smallest(arr, 9, heap, 5);
printv(heap, 5);
getchar();
return 0;
}
开发者ID:blackball,项目名称:boring,代码行数:14,代码来源:min-heap.c
示例7: cos_init
void cos_init(void)
{
cbuf_t cbs[MAX_CBUFS];
int szs[MAX_CBUFS];
char *bufs[MAX_CBUFS];
int i;
printc("UNIT TEST Unit tests for cbufs...\n");
for (i = 0 ; i < MAX_CBUFS ; i++) {
int sz = (rand() % MAX_CBUF_SZ) + 1;
bufs[i] = cbuf_alloc(sz, &cbs[i]);
printv("UNIT TEST alloc %d -> %p\n", sz, bufs[i]);
assert(bufs[i]);
cbuf_free(bufs[i]);
printv("UNIT TEST free %p\n", bufs[i]);
}
printc("UNIT TEST PASSED: alloc->dealloc\n");
for (i = 0 ; i < MAX_CBUFS ; i++) {
int sz = (rand() % MAX_CBUF_SZ) + 1;
bufs[i] = cbuf_alloc(sz, &cbs[i]);
printv("UNIT TEST alloc %d -> %p\n", sz, bufs[i]);
assert(bufs[i]);
}
for (i = 0 ; i < MAX_CBUFS ; i++) {
cbuf_free(bufs[i]);
printv("UNIT TEST free %p\n", bufs[i]);
}
printc("UNIT TEST PASSED: N alloc -> N dealloc\n");
for (i = 0 ; i < MAX_CBUFS ; i++) {
int sz = (rand() % MAX_CBUF_SZ) + 1;
bufs[i] = cbuf_alloc(sz, &cbs[i]);
printv("UNIT TEST alloc %d -> %p\n", sz, bufs[i]);
szs[i] = sz;
assert(bufs[i]);
bufs[i][0] = '_';
unit_cbuf(cbs[i], sz);
assert(bufs[i][0] == '*');
printv("UNIT TEST cbuf2buf %d\n", sz);
}
printc("UNIT TEST PASSED: N alloc + cbuf2buf\n");
for (i = 0 ; i < MAX_CBUFS ; i++) {
bufs[i][0] = '_';
unit_cbuf(cbs[i], szs[i]);
printv("UNIT TEST cbuf2buf %d\n", szs[i]);
}
printc("UNIT TEST PASSED: N cached cbuf2buf\n");
for (i = 0 ; i < MAX_CBUFS ; i++) {
cbuf_free(bufs[i]);
printv("UNIT TEST free %p\n", bufs[i]);
}
printc("UNIT TEST PASSED: N deallocs\n");
printc("UNIT TEST ALL PASSED\n");
return;
}
开发者ID:EmuxEvans,项目名称:CompositeFreeRTOS,代码行数:59,代码来源:cbufc.c
示例8: learn_expand_or_one
static int learn_expand_or_one(struct solver_state *s, int w, int h) {
const int sz = w * h;
int i;
int learn = FALSE;
assert(s);
for (i = 0; i < sz; ++i) {
int j;
int one = TRUE;
if (s->board[i] != EMPTY) continue;
for (j = 0; j < 4; ++j) {
const int x = (i % w) + dx[j];
const int y = (i / w) + dy[j];
const int idx = w*y + x;
if (x < 0 || x >= w || y < 0 || y >= h) continue;
if (s->board[idx] == EMPTY) {
one = FALSE;
continue;
}
if (one &&
(s->board[idx] == 1 ||
(s->board[idx] >= expandsize(s->board, s->dsf, w, h,
i, s->board[idx]))))
one = FALSE;
assert(s->board[i] == EMPTY);
s->board[i] = -SENTINEL;
if (check_capacity(s->board, w, h, idx)) continue;
assert(s->board[i] == EMPTY);
printv("learn: expanding in one\n");
expand(s, w, h, i, idx);
learn = TRUE;
break;
}
if (j == 4 && one) {
printv("learn: one at (%d, %d)\n", i % w, i / w);
assert(s->board[i] == EMPTY);
s->board[i] = 1;
assert(s->nempty);
--s->nempty;
learn = TRUE;
}
}
return learn;
}
开发者ID:palfrey,项目名称:sgtpuzzles,代码行数:48,代码来源:filling.c
示例9: printv_func
void THIS::init(parent_t * const & p)
{
printv_func(DEBUG);
setParent(p);
auto app = get_fnd_app();
if(app->G::has_object())
if(!G::has_object())
G::make_object<THIS, int>(
app->get_graphics_plugin(),
neb::fnd::plug::gfx::core::shape::type::CUBOID);
if(app->P::has_object()) {
if(P::has_object()) {
printv(DEBUG, "phx plugin not null\n");
} else {
P::make_object<THIS, int>(
app->get_physics_plugin(),
neb::fnd::plug::phx::core::shape::type::CUBOID);
}
}
neb::fnd::core::shape::base::init(p);
//neb::gfx::core::shape::base::init(p);
//neb::gfx::core::shape::box::init(p);
//neb::phx::core::shape::base::init(p);
//neb::phx::core::shape::box::init(p);
//neb::fin::core::shape::base::init(p);
}
开发者ID:nebula-engine,项目名称:Nebula-Core,代码行数:34,代码来源:Box.cpp
示例10: printv_func
void neb::gfx::Viewport::load()
{
printv_func(DEBUG);
printv(DEBUG, "x %i y %i w %i h %i\n", x_, y_, w_, h_);
glViewport(x_, y_, w_, h_);
}
开发者ID:nebula-engine,项目名称:Nebula-Graphics,代码行数:7,代码来源:viewport.cpp
示例11: learn_critical_square
static int learn_critical_square(struct solver_state *s, int w, int h) {
const int sz = w * h;
int i;
int learn = FALSE;
assert(s);
/* for each connected component */
for (i = 0; i < sz; ++i) {
int j;
if (s->board[i] == EMPTY) continue;
if (i != dsf_canonify(s->dsf, i)) continue;
if (dsf_size(s->dsf, i) == s->board[i]) continue;
assert(s->board[i] != 1);
/* for each empty square */
for (j = 0; j < sz; ++j) {
if (s->board[j] != EMPTY) continue;
s->board[j] = -SENTINEL;
if (check_capacity(s->board, w, h, i)) continue;
/* if not expanding s->board[i] to s->board[j] implies
* that s->board[i] can't reach its full size, ... */
assert(s->nempty);
printv(
"learn: ds %d at (%d, %d) blocking (%d, %d)\n",
s->board[i], j % w, j / w, i % w, i / w);
--s->nempty;
s->board[j] = s->board[i];
filled_square(s, w, h, j);
learn = TRUE;
}
}
return learn;
}
开发者ID:palfrey,项目名称:sgtpuzzles,代码行数:32,代码来源:filling.c
示例12: print_board
static void print_board(int *board, int w, int h) {
if (verbose) {
char *repr = board_to_string(board, w, h);
printv("%s\n", repr);
free(repr);
}
}
开发者ID:palfrey,项目名称:sgtpuzzles,代码行数:7,代码来源:filling.c
示例13: provaCalcS
/*
* Test 1
* */
void provaCalcS(){
printf("halloo, probando probando!!\n");
vector pc = zerov(2);
vector pcPrimes = zerov(2);
matrix S = zerom(2, 3);
pc.v[0] = 50; pc.v[1] = 200;
//Test in matlab
//S = [ 0 0.0003495 0.002; 0.0018 0.0338 0.0207];
S.m[0][0] = 0; S.m[0][1] = 0.0003495; S.m[0][2] = 0.002;
S.m[1][0] = 0.0018; S.m[1][1] = 0.0338; S.m[1][2] = 0.0207;
int numPrimes = (int)(pc.v[pc.x - 1] / pc.v[0]);
intvector numsPrimesReason = primes(numPrimes);
int i, j;
for(i = 0; i < numsPrimesReason.x; ++i){
printf("i: %d\n", numsPrimesReason.v[i]);
int primeNum = numsPrimesReason.v[i];
for(j = 0; j < pcPrimes.x; ++j){
pcPrimes.v[j] = pc.v[j] * primeNum;
}
printf("\nArray pcPrimes:\n");
printv(pcPrimes);
matrix SnInterp = interp1Mat(pc, pcPrimes, S, 0);
printf("\nResult S\n");
printm(SnInterp);
}
}
开发者ID:d-unknown-processor,项目名称:Aud-SWIPE-P,代码行数:34,代码来源:main.c
示例14: printv
void THIS::step(
gal::etc::timestep const & ts)
{
printv(DEBUG, "%s\n", __PRETTY_FUNCTION__);
neb::fnd::core::shape::util::parent::step(ts);
neb::fnd::core::light::util::parent::step(ts);
}
开发者ID:nebula-engine,项目名称:Nebula-Core,代码行数:7,代码来源:base.cpp
示例15: main
int main(void)
{
int x, y;
int cs, st;
srand((unsigned)(time(NULL)));
setlocale(LC_ALL, "zh_TW.UTF-8");
while(1)
{
x=1, y=1+(int)(20.*rand()/(1.+RAND_MAX));
printf("\x1b[2J");
while(x<=70)
{
cs=(int)(2.*rand()/(1.+RAND_MAX));
if(cs)
{
st=(int)(2.*rand()/(1.+RAND_MAX));
if(y==20){ st=0; }
else if(y==1){ st=1; }
printv(&x, &y, st);
}
else
{
printf("\x1b[%d;%dH%lc", y, x, linec[0]);
pwhite(x, y+1);
x+=1;
}
}
}
return 0;
}
开发者ID:YWJamesLin,项目名称:NCU_Classes,代码行数:32,代码来源:week_test_7.c
示例16: enum_start
/*
* Enumerate over all elements in a container.
*/
static void *
enum_start(void *arg)
{
char *err;
uint64_t num = 0;
fdf.ctr_t *ctr = arg;
zs_iter_t *iter = zs_iter_init(ctr, &err);
if (!iter)
die_err(err, "zs_iter_init failed");
for (;;) {
char *key;
char *data;
uint64_t keylen;
uint64_t datalen;
int s = zs_iter_next(iter, &key, &keylen, &data, &datalen, &err);
if (s < 0)
die_err(err, "zs_iter_next failed");
if (s == 0)
break;
num++;
}
if (!zs_iter_done(iter, &err))
die_err(err, "zs_iter_done failed");
if (num != Objects)
die("enumerated %ld/%ld objects", num, Objects);
printv("enumerated %ld/%ld objects", num, Objects);
return NULL;
}
开发者ID:AlfredChenxf,项目名称:zetascale,代码行数:35,代码来源:test_enum1.c
示例17: create_buffer
int create_buffer(int i) {
/* DO NOT CALL ANY MARKS FUNCTIONS HERE */
int ret = -1;
int fd = open_rdrw();
if (fd < 0) {
ret = 4;
goto end;
}
ret = ioctl(fd, CRYPTO_IOCCREATE, 0);
if (ret < 0) {
fprintf(stderr, "ioctl(CRYPTO_IOCCREATE) #%d", i);
printe("");
ret = 5;
goto end;
}
printv("Created buffer with id %d\n", ret);
ret = 0;
end:
if (fd >= 0) {
close(fd);
}
return ret;
}
开发者ID:sjkingo-archive,项目名称:comp3301-a2-spec,代码行数:27,代码来源:test_2c_create_multiple_buffers_multiple.c
示例18: main
int main(int argc, char *argv[]) {
float a[] = {12, -7.5, 6.5, -3, -8, 7.5};
aranjare(a, 6);
printv(a, 6);
return 0;
}
开发者ID:scvalex,项目名称:bac2008,代码行数:7,代码来源:III_3.c
示例19: print
print(const char *a, ...)
{
__builtin_va_list l;
__builtin_va_start(l, a);
int const t = printv(a, l);
__builtin_va_end(l);
return t;
}
开发者ID:8l,项目名称:ucc-c-compiler,代码行数:8,代码来源:typeof.c
示例20: main
int main() {
std::vector<int> vi = {1, 9, 8, 8};
std::list<int> li1 = {1, 9, 8, 9};
std::list<int> li2 = {1, 9, 8};
std::list<int> li3 = {1, 9, 8, 8};
std::string joinstr;
int cmp = compare(vi, li1);
if (cmp == 0)
joinstr = " == ";
else if (cmp > 0)
joinstr = " > ";
else
joinstr = " < ";
printv(vi);
std::cout << joinstr;
printl(li1);
std::cout << std::endl;
cmp = compare(vi, li2);
if (cmp == 0)
joinstr = " == ";
else if (cmp > 0)
joinstr = " > ";
else
joinstr = " < ";
printv(vi);
std::cout << joinstr;
printl(li2);
std::cout << std::endl;
cmp = compare(vi, li3);
if (cmp == 0)
joinstr = " == ";
else if (cmp > 0)
joinstr = " > ";
else
joinstr = " < ";
printv(vi);
std::cout << joinstr;
printl(li3);
std::cout << std::endl;
return 0;
}
开发者ID:KwangKa,项目名称:CppPrimer5th,代码行数:46,代码来源:ex9_16.cpp
注:本文中的printv函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论