当前位置: 首页>>代码示例>>C++>>正文


C++ set_path函数代码示例

本文整理汇总了C++中set_path函数的典型用法代码示例。如果您正苦于以下问题:C++ set_path函数的具体用法?C++ set_path怎么用?C++ set_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: g_ril_request_sim_read_record

gboolean g_ril_request_sim_read_record(GRil *gril,
					const struct req_sim_read_record *req,
					struct parcel *rilp)
{
	parcel_init(rilp);
	parcel_w_int32(rilp, CMD_READ_RECORD);
	parcel_w_int32(rilp, req->fileid);

	g_ril_append_print_buf(gril,
				"(cmd=0x%.2X,efid=0x%.4X,",
				CMD_READ_RECORD,
				req->fileid);

	if (set_path(gril, req->app_type, rilp, req->fileid,
			req->path, req->path_len) == FALSE)
		goto error;

	parcel_w_int32(rilp, req->record);      /* P1 */
	parcel_w_int32(rilp, 4);           /* P2 */
	parcel_w_int32(rilp, req->length);      /* P3 */
	parcel_w_string(rilp, NULL);       /* data; only req'd for writes */
	parcel_w_string(rilp, NULL);       /* pin2; only req'd for writes */
	parcel_w_string(rilp, req->aid_str); /* AID (Application ID) */

	return TRUE;

error:
	return FALSE;
}
开发者ID:jpakkane,项目名称:ofono,代码行数:29,代码来源:grilrequest.c

示例2: path_finding

/**
 * \brief Calculates the direction and the speed of the movement
 * depending on the target.
 */
void PathFindingMovement::recompute_movement() {

  if (target != nullptr) {
    PathFinding path_finding(get_entity()->get_map(), *get_entity(), *target);
    std::string path = path_finding.compute_path();

    uint32_t min_delay;
    if (path.size() == 0) {
      // the target is too far or there is no path
      path = create_random_path();

      // no path was found: no need to try again very soon
      // (note that the A* algorithm is very costly when it explores all nodes without finding a solution)
      min_delay = 3000;
    }
    else {
      // a path was found: we need to update it frequently (and the A* algorithm is much faster in general when there is a solution)
      min_delay = 300;
    }
    // compute a new path every random delay to avoid
    // having all path-finding entities of the map compute a path at the same time
    next_recomputation_date = System::now() + min_delay + Random::get_number(200);

    set_path(path);
  }
}
开发者ID:Maxs1789,项目名称:solarus,代码行数:30,代码来源:PathFindingMovement.cpp

示例3: defined

int 
Recorder::open_path ( const char * filename ) {
   cerr << "Recorder::open_path  - - Nothin yet" << endl;
   cerr << "filename is " << filename << endl; 
   fstream fin;
#if (defined (WIN32) && defined(_MSC_VER) && (_MSC_VER <=1300)) /*VS 6.0*/
   fin.open ( filename, ios::in | ios::nocreate);
#else
   fin.open ( filename, ios::in );
#endif
   if ( !fin )
      {
         err_ret("Recorder::open_path: error opening file");
      }
   CameraPath * tmp = new CameraPath ( filename );
   if ( !tmp->read_stream (fin )) return 0;
   fin.close();
   _campaths.push_back ( tmp );
   _ui->add_path_entry ( _campaths.size()-1, filename );
   //set the opened path to be the current path
   cerr << "num is " << _campaths.size() << endl;
   set_path ( _campaths.size()-1 ) ;
   cerr << "end open " << endl;

   return 1;
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:26,代码来源:recorder.cpp

示例4: getattr_1_svc

bool_t getattr_1_svc(ne_getattr_arg arg, ne_getattr_res *res, struct svc_req *req)
{
	char path[PATH_MAX];
	static struct stat stbuf;

	memset((char *)&stbuf, 0, sizeof(stbuf));
	set_path(path, arg.path);

	res->res = lstat(path, &stbuf);

	printf("getattr_svc:%s\n", path);
	res->stbuf.dev = stbuf.st_dev;
	res->stbuf.ino = stbuf.st_ino;
	res->stbuf.mode = stbuf.st_mode;
//	printf("%u\n", stbuf.st_mode);
	res->stbuf.nlink = stbuf.st_nlink;
	res->stbuf.uid = stbuf.st_uid;
	res->stbuf.gid = stbuf.st_gid;
	res->stbuf.rdev = stbuf.st_rdev;
	res->stbuf.size = stbuf.st_size;
	res->stbuf.atime = stbuf.st_atime;
	res->stbuf.mtime = stbuf.st_mtime;
	res->stbuf.ctime = stbuf.st_ctime;
	res->stbuf.blksize = stbuf.st_blksize;
	res->stbuf.blocks = stbuf.st_blocks;

	if (res->res == -1)
		res->res = -errno;

	return TRUE;
}
开发者ID:prtitrz,项目名称:Nefs,代码行数:31,代码来源:master.c

示例5: main

int		main(int ac, char **av)
{
  int		v;
  t_map		map;
  t_graph	**pile;

  if (ac != 2)
    return (1);
  if (load_map(&map, av[1]) == -1 ||
      create_graph(&map) == -1 ||
      link_room(&map) == -1)
    return (1);
  if ((pile = malloc(sizeof(t_graph *))) == NULL)
    return (1);
  *pile = NULL;
  if ((v = search_path(map.start, map.end, &pile)) == 0)
    {
      printf("No solution found\n");
      return (1);
    }
  else if (v == -1)
    return (2);
  set_path(map.end);
  show_map(&map);
  free(pile);
  free_all(&map);
  return (0);
}
开发者ID:devillh,项目名称:Epitech_projects,代码行数:28,代码来源:main.c

示例6: readdir_1_svc

bool_t readdir_1_svc(ne_readdir_arg arg, ne_readdir_res *res, struct svc_req *req)
{
	DIR *dp;
	struct dirent *de;
	ne_dirent **d;
	ne_dirent *p;
	char path[PATH_MAX];

	set_path(path, arg.path);

	printf("readdir_svc:%s\n", path);
	dp = opendir(path);
	//TODO
	if (dp == NULL) {
		return TRUE;
	}

	d = &(res->dirent);

	while ((de = readdir(dp)) != NULL) {
		p = *d = (ne_dirent *)malloc(sizeof(ne_dirent));
		//TODO:memory full
		p->d_ino = de->d_ino;
		p->d_name = strdup(de->d_name);
		d = &p->next;
	}
	*d = (ne_dirent *)NULL;

	closedir(dp);
	return TRUE;
}
开发者ID:prtitrz,项目名称:Nefs,代码行数:31,代码来源:master.c

示例7: link_1_svc

bool_t link_1_svc(ne_link_arg arg, ne_link_res *res, struct svc_req *req)
{
	char from[PATH_MAX];
	char to[PATH_MAX];

	set_path(from, arg.from);
	set_path(to, arg.to);

	printf("symlink_svc:%s%s\n", from, to);
	res->res = link(from, to);

	if (res->res == -1) 
		res->res = -errno;

	return TRUE;
}
开发者ID:prtitrz,项目名称:Nefs,代码行数:16,代码来源:master.c

示例8: g_ril_request_sim_read_record

gboolean g_ril_request_sim_read_record(GRil *gril,
					const struct req_sim_read_record *req,
					struct parcel *rilp)
{
	parcel_init(rilp);
	parcel_w_int32(rilp, CMD_READ_RECORD);
	parcel_w_int32(rilp, req->fileid);

	g_ril_append_print_buf(gril,
				"(cmd=0x%.2X,efid=0x%.4X,",
				CMD_READ_RECORD,
				req->fileid);

	if (set_path(gril, req->app_type, rilp, req->fileid,
			req->path, req->path_len) == FALSE)
		goto error;

	parcel_w_int32(rilp, req->record);      /* P1 */
	parcel_w_int32(rilp, 4);           /* P2 */
	parcel_w_int32(rilp, req->length);      /* P3 */
	parcel_w_string(rilp, NULL);       /* data; only req'd for writes */
	parcel_w_string(rilp, NULL);       /* pin2; only req'd for writes */
	parcel_w_string(rilp, req->aid_str); /* AID (Application ID) */

	/* sessionId, specific to latest MTK modems (harmless for older ones) */
	if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK)
		parcel_w_int32(rilp, 0);

	return TRUE;

error:
	return FALSE;
}
开发者ID:morphis,项目名称:ofono,代码行数:33,代码来源:grilrequest.c

示例9: get_entity

/**
 * \brief Updates the position.
 */
void PathFindingMovement::update() {

  PathMovement::update();

  if (target != nullptr && target->is_being_removed()) {
    target = nullptr;
  }

  if (is_suspended()) {
    return;
  }

  if (PathMovement::is_finished()) {

    // there was a collision or the path was made
    if (target != nullptr
        && System::now() >= next_recomputation_date
        && get_entity()->is_aligned_to_grid()) {
      recompute_movement();
    }
    else {
      set_path(create_random_path());
    }
  }
}
开发者ID:Maxs1789,项目名称:solarus,代码行数:28,代码来源:PathFindingMovement.cpp

示例10: malloc

void *file_new(const char *path)
{
	t_file *file = (t_file *) malloc( sizeof( t_file));

	id_init( &file->id, path);

	memset( file->id.name,'\0',_NAME_);
	memset( file->ext,'\0',_EXT_);
	memset( file->path,'\0',_PATH_);

	set_path( file->path, path);

	file->is_relative = 0;
	file->is_directory = 0;
	file->has_extention = 0;
	file->path_type = 0;

	file->data = NULL;
	file->lines = NULL;
	file->file = NULL;

	file->data_size = 0;
	file->tot_line = 0;
	file->dir_count = 0;
	file->exists = 0;

	bzero( file->dirs, FILE_MAX_DIR * _NAME_LONG_);
	bzero( file->dir_path, _PATH_);

	return file;
}
开发者ID:colinbouvry,项目名称:minuit,代码行数:31,代码来源:file.c

示例11: parse_path

void 
Path::set_path (const std::string& colon_path)
{ 
  std::vector<symbol> result;
  parse_path (colon_path, result);
  set_path (result);
}
开发者ID:pamoakoy,项目名称:daisy-model,代码行数:7,代码来源:path.C

示例12: main

int main(int argc, char * argv[]) {
	/* Starts a graphical session and then spins waiting for a kill (logout) signal */

	/* Load some session variables */
	set_username();
	set_homedir();
	set_path();

	int _wallpaper_pid = fork();
	if (!_wallpaper_pid) {
		char * args[] = {"/bin/wallpaper", NULL};
		execvp(args[0], args);
	}
	int _panel_pid = fork();
	if (!_panel_pid) {
		char * args[] = {"/bin/panel", NULL};
		execvp(args[0], args);
	}

	syscall_wait(_panel_pid);

	printf("Session leader has exited. Sending INT signals to %d.\n", _wallpaper_pid);

	syscall_send_signal(_wallpaper_pid, 2);

	printf("Waiting on wallpaper.\n");
	syscall_wait(_wallpaper_pid);

	printf("Session has ended.\n");

}
开发者ID:Razi007,项目名称:toaruos,代码行数:31,代码来源:gsession.c

示例13: client_playcount

/* Increment the playcount of <file> by one. Either connect to a
 running instance of gtkpod and transfer the filename, or write the
 name to ~/.gtkpod/offline_playcounts.
 Return value: TRUE on success, FALSE if a non-recoverable error
 occurred */
gboolean client_playcount(gchar *file) {
    if (socket_used()) { /* send filename to currently running gtkpod instance */
        struct sockaddr_un *server;

        server = g_malloc0(sizeof(struct sockaddr_un));
        set_path(server);
        if (g_file_test(server->sun_path, G_FILE_TEST_EXISTS)) {
            gint csock = socket(AF_UNIX, SOCK_STREAM, 0);
            if (csock != -1) {
                server->sun_family = AF_UNIX;
                if (connect(csock, (struct sockaddr *) server, sizeof(struct sockaddr_un)) != -1) {
                    gchar *buf = g_strdup_printf("%s%s", SOCKET_PLYC, file);
                    size_t buf_len = strlen(buf);
                    if (write(csock, buf, buf_len) != (ssize_t) buf_len) {
                        fprintf(stderr, "Error communicating to server. Playcount registered in offline database.\n");
                        register_playcount(file);
                    }
                    g_free(buf);
                }
                close(csock);
            }
        }
        g_free(server);
    }
    else { /* write filename to ~/.gtkpod/offline_playcounts */
        register_playcount(file);
    }
    return TRUE;
}
开发者ID:Sprezzatech,项目名称:gtkpod,代码行数:34,代码来源:clientserver.c

示例14: server_setup

void server_setup(void) {
    if (ssock != -1)
        return; /* already opened */
    if (socket_used()) {
        /* we are not the first instance of gtkpod -- the socket is
         already being used, so we pass */
        gtkpod_warning(_("Another instance of gtkpod was detected. Playcount server not started.\n"));
        return;
    }
    ssock = socket(AF_UNIX, SOCK_STREAM, 0);
    if (ssock != -1) {
        if (saddr == NULL) {
            saddr = g_malloc0(sizeof(struct sockaddr_un));
            saddr->sun_family = AF_UNIX;
        }
        set_path(saddr);
        unlink(saddr->sun_path);
        if (bind(ssock, (struct sockaddr *) saddr, sizeof(struct sockaddr_un)) != -1) {
            listen(ssock, 5);
            /* socket must be non-blocking -- otherwise
             received_message() will block */
            fcntl(ssock, F_SETFL, O_NONBLOCK);
            channel = g_io_channel_unix_new(ssock);
            inp_handler = g_io_add_watch(channel, G_IO_IN, received_message, NULL);
        }
        else {
            fprintf(stderr, "server: bind error: %s", strerror(errno));
            close(ssock);
            ssock = -1;
        }
    }
    else {
        fprintf(stderr, "server: socket error: %s", strerror(errno));
    }
}
开发者ID:Sprezzatech,项目名称:gtkpod,代码行数:35,代码来源:clientserver.c

示例15: g_ril_request_sim_read_binary

gboolean g_ril_request_sim_read_binary(GRil *gril,
					const struct req_sim_read_binary *req,
					struct parcel *rilp)
{
	g_ril_append_print_buf(gril,
				"(cmd=0x%.2X,efid=0x%.4X,",
				CMD_READ_BINARY,
				req->fileid);

	parcel_init(rilp);
	parcel_w_int32(rilp, CMD_READ_BINARY);
	parcel_w_int32(rilp, req->fileid);

	if (set_path(gril, req->app_type, rilp, req->fileid,
			req->path, req->path_len) == FALSE)
		goto error;

	parcel_w_int32(rilp, (req->start >> 8));   /* P1 */
	parcel_w_int32(rilp, (req->start & 0xff)); /* P2 */
	parcel_w_int32(rilp, req->length);         /* P3 */
	parcel_w_string(rilp, NULL);          /* data; only req'd for writes */
	parcel_w_string(rilp, NULL);          /* pin2; only req'd for writes */
	parcel_w_string(rilp, req->aid_str);

	return TRUE;

error:
	return FALSE;
}
开发者ID:jpakkane,项目名称:ofono,代码行数:29,代码来源:grilrequest.c


注:本文中的set_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。