本文整理汇总了C++中write_line函数的典型用法代码示例。如果您正苦于以下问题:C++ write_line函数的具体用法?C++ write_line怎么用?C++ write_line使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_line函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fmt
void fmt(char *line_full, ssize_t line_remaining_len, int width) {
char *line = line_full;
ssize_t line_len;
int i;
bool split_on_space = false;
while (line_remaining_len > width) {
line_len = width;
for (i = 1; i < line_len; i++) {
if (line[line_len - i] == ' ') {
line_len = line_len - i;
split_on_space = true;
break;
}
}
write_line(line, line_len);
if (split_on_space) {
line_remaining_len--;
line++;
}
line_remaining_len -= line_len;
line += line_len;
}
if (line_remaining_len > 0) {
write_line(line, line_remaining_len);
}
}
示例2: main
int main()
{
write_line("Calling test function");
TestFunc();
write_line("After test function");
return 0;
}
示例3: im_write_imask_name
/**
* im_write_imask_name:
* @in: mask to write
* @filename: filename to write to
*
* Write an imask to a file. See im_read_dmask() for a description of the mask
* file format.
*
* See also: im_write_imask().
*
* Returns: 0 on success, or -1 on error.
*/
int
im_write_imask_name( INTMASK *in, const char *filename )
{
FILE *fp;
int x, y, i;
if( im_check_imask( "im_write_imask_name", in ) ||
!(fp = im__file_open_write( filename, TRUE )) )
return( -1 );
if( write_line( fp, "%d %d", in->xsize, in->ysize ) ) {
fclose( fp );
return( -1 );
}
if( in->scale != 1 || in->offset != 0 )
write_line( fp, " %d %d", in->scale, in->offset );
write_line( fp, "\n" );
for( i = 0, y = 0; y < in->ysize; y++ ) {
for( x = 0; x < in->xsize; x++, i++ )
write_line( fp, "%d ", in->coeff[i] );
if( write_line( fp, "\n" ) ) {
fclose( fp );
return( -1 );
}
}
fclose( fp );
return( 0 );
}
示例4: end_line
static int end_line(char **rest, char **line, int const fd, char *buf)
{
int ret_read;
char *end;
char *tmp;
while (1)
{
if (ft_strchr(*rest, '\n') != NULL)
{
tmp = ft_strdup(*rest);
end = ft_strchr(tmp, '\n');
end = end + 1;
write_line(rest, end, line);
ft_memdel((void**)&tmp);
return (1);
}
ft_bzero(buf, BUFF_SIZE);
if ((ret_read = read(fd, buf, BUFF_SIZE)) == 0)
{
if (ft_strlen(*rest) > 0)
write_line(rest, NULL, line);
return (0);
}
join_rest(rest, buf);
}
}
示例5: TestFunc
void TestFunc()
{
write_line("Before first notification");
__annotation_mark(loc1);
write_line("Before second notification");
__annotation_mark(loc2);
write_line("After second notification");
}
示例6: write_store
void write_store(item_t *dst_item, item_t *src_item)
{
if (!dst_item || !src_item) return;
// Se o item de origem já estiver em um registrador, a função “write_load” não mudará nada
write_load(src_item);
if (dst_item->addressing == addressing_indirect)
write_line("STORE [R%d], R%d", dst_item->index, src_item->index);
else
write_line("STORE [%.4X], R%d", dst_item->address, src_item->index);
dst_item->addressing = addressing_register;
dst_item->index = src_item->index;
// TODO: Se for reaproveitar o destino para as próximas contas, é necessário reduzir o índice de registradores?
dec_index(1);
}
示例7: print_shell_use
void print_shell_use() {
write_line("Comandos disponibles:");
write_line("help muestra esta ayuda");
write_line("ls muestra la lista de programas disponibles");
write_line("ps muestra datos sobre los procesos del sistema");
write_line("run <programa> ejecuta un programa en foreground");
write_line("bg <programa> ejecuta un programa en background");
write_line("nice <pid> <valor> cambia la prioridad de un proceso");
write_line("kill <pid> mata un proceso");
write_line("echo <palabra> imprime una palabra");
}
示例8: write_branch_link
void write_branch_link(item_t *item, bool forward)
{
if (forward) {
fpos_t position;
fgetpos(output_file, &position);
add_link(create_link(position), &item->links);
write_line(BACKEND_FORWARD_LABEL);
}
else {
if (item->label)
write_line(item->label);
else
write_line("GOD_KNOWS_WHERE!");
}
}
示例9: write_index_offset
void write_index_offset(item_t *item, item_t *index_item)
{
if (!item || !index_item) return;
// TODO: Adicionar rotina “trap” para índices fora do limite
write_load(index_item);
write_line("MUL R%d, %d", index_item->index, item->type->base->size);
if (item->addressing == addressing_direct) {
write_line("ADD R%d, %d", index_item->index, item->address);
item->index = index_item->index;
item->addressing = addressing_indirect;
}
else if (item->addressing == addressing_indirect) {
write_line("ADD R%d, R%d", item->index, index_item->index);
dec_index(1);
}
}
示例10: while
// writes changes to a writable book to the bok file.
void cBooks::readbook_writeable(UOXSOCKET s, P_ITEM pBook, int p, int l)
{
int ii=0,lines_processed=0,lin=0;
char line[34],ch;
unsigned long loopexit=0;
if (a_t) write_title(pBook,s); // if title was changed by writer write the changes "down"
if (a_t) write_author(pBook,s); // if author was changed by writer write the changes "down" to the bok-file
while (lines_processed<l && (++loopexit < MAXLOOPS) )
{
if (ii>511) lines_processed=l; // avoid crash if client sends out inconsitent data
ch=pagebuffer[s][ii];
if (lin<33) line[lin]=ch; else line[33]=ch;
ii++;
lin++;
if (ch==0)
{
lines_processed++;
lin=0;
write_line(pBook, p, lines_processed, line,s);
}
}
a_t=0; // dont re-write author and title if not necassairy
}
示例11: main
int main(int argc, char ** argv)
{
// initialize and watch the entire directory tree from the current working
// directory downwards for all events
if ( !inotifytools_initialize() || !inotifytools_watch_recursively( "/proc/acpi/ac_adapter/AC/", IN_ALL_EVENTS ) )
{
fprintf(stderr, "%s\n", strerror( inotifytools_error() ) );
return -1;
}
// set time format to 24 hour time, HH:MM:SS
inotifytools_set_printf_timefmt( "%T" );
// Output all events as "<timestamp> <path> <events>"
struct inotify_event * event = inotifytools_next_event( -1 );
if ( event )
{
inotifytools_printf( event, "%T %w%f %e\n" );
event = inotifytools_next_event( -1 );
}
// Configure userspace as the scaling governor in ACPI
write_line(ACPI_GOVERNOR_FILE, "userspace");
// Start past/mdp/avgn/maxperf/maxlife
// Start phoronix-test-suite benchmark mdp
start_pts(argv[2]);
start_dvs_program(argv[1]);
}
示例12: switch
static struct COOR *end_line(struct COOR *ptr, int node)
{
ptr->row = row;
ptr->col = col - 1;
ptr->node = node;
switch (data_type) {
case CELL_TYPE:
ptr->val = ((CELL *) middle)[col];
break;
case FCELL_TYPE:
ptr->dval = ((FCELL *) middle)[col];
break;
case DCELL_TYPE:
ptr->dval = ((DCELL *) middle)[col];
break;
default:
break;
}
G_debug(3, "end_line: node: %d; p: row:%d, col:%d",
node, ptr->row, ptr->col);
ptr->fptr = ptr;
write_line(ptr);
return (NULL);
}
示例13: dump
void
istream_line_splitter::
dump(std::ostream& os) const {
os << "\tline_no: " << _line_no << "\n";
os << "\tline: ";
write_line(os);
}
示例14: getParent
void THIS::eval(std::string const & s)
{
auto parent = getParent();
bp::object o;
try {
o = bp::eval(s.c_str(), main_namespace_);
if(!o.is_none()) {
main_namespace_["temp_obj"] = o;
bp::exec("print temp_obj", main_namespace_);
}
} catch(bp::error_already_set const &) {
PyErr_Clear();
//PyErr_Print();
try {
o = bp::exec(s.c_str(), main_namespace_, bp::object());
} catch(bp::error_already_set const &) {
PyErr_Print();
}
PyErr_Print();
}
auto output = PythonStdIoRedirect::GetOutputContainer();
for(auto it = output.begin(); it != output.end(); ++it)
parent->write_line(*it);//.insert(lines_.end(), output.begin(), output.end());
}
示例15: write_objects
int
write_objects(FILE *fp)
{
F_arc *a;
F_compound *c;
F_ellipse *e;
F_line *l;
F_spline *s;
F_text *t;
/*
* A 2 for the orientation means that the origin (0,0) is at the upper
* left corner of the screen (2nd quadrant).
*/
if (!update_figs)
put_msg("Writing . . .");
#ifdef I18N
/* set the numeric locale to C so we get decimal points for numbers */
setlocale(LC_NUMERIC, "C");
#endif /* I18N */
write_fig_header(fp);
for (a = objects.arcs; a != NULL; a = a->next) {
num_object++;
write_arc(fp, a);
}
for (c = objects.compounds; c != NULL; c = c->next) {
num_object++;
write_compound(fp, c);
}
for (e = objects.ellipses; e != NULL; e = e->next) {
num_object++;
write_ellipse(fp, e);
}
for (l = objects.lines; l != NULL; l = l->next) {
num_object++;
write_line(fp, l);
}
for (s = objects.splines; s != NULL; s = s->next) {
num_object++;
write_spline(fp, s);
}
for (t = objects.texts; t != NULL; t = t->next) {
num_object++;
write_text(fp, t);
}
#ifdef I18N
/* reset to original locale */
setlocale(LC_NUMERIC, "");
#endif /* I18N */
if (ferror(fp)) {
fclose(fp);
return (-1);
}
if (fclose(fp) == EOF)
return (-1);
return (0);
}