• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: set_slot_from_value

static void
set_slot_from_value (slot_info_t* pInfo, KvpValue* pValue)
{
    g_return_if_fail (pInfo != NULL);
    g_return_if_fail (pValue != NULL);

    switch (pInfo->context)
    {
    case FRAME:
    {
        auto key = get_key_from_path (pInfo->path);
        pInfo->pKvpFrame->set (key.c_str(), pValue);
        break;
    }
    case LIST:
    {
        pInfo->pList = g_list_append (pInfo->pList, pValue);
        break;
    }
    case NONE:
    default:
    {
        auto key = get_key_from_path (pInfo->path);
        auto path = get_path_from_path (pInfo->path);
        auto frame = pInfo->pKvpFrame;
        if (!path.empty())
        {
            frame->set_path ({path.c_str(), key.c_str()}, pValue);
        }
        else
            frame->set (key.c_str(), pValue);
        break;
    }
    }
}
开发者ID:goodvibes2,项目名称:gnucash,代码行数:35,代码来源:gnc-slots-sql.cpp


示例17: mutt_open_append_compressed

int mutt_open_append_compressed (CONTEXT * ctx)
{
    FILE *fh;
    COMPRESS_INFO *ci = set_compress_info (ctx);

    if (!get_append_command (ctx->path, ctx)) {
        if (ci->open && ci->close)
            return (mutt_open_read_compressed (ctx));

        ctx->magic = 0;
        mem_free (&ctx->compressinfo);
        return (-1);
    }

    set_path (ctx);

    ctx->magic = DefaultMagic;

    if (!is_new (ctx->realpath))
        if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
            if ((fh = safe_fopen (ctx->path, "w")))
                fclose (fh);
    /* No error checking - the parent function will catch it */

    return (0);
}
开发者ID:BackupTheBerlios,项目名称:mutt-ng-svn,代码行数:26,代码来源:compress.c


示例18: modify_environment

static void
modify_environment (const struct passwd *pw, const char *shell)
{
  if (simulate_login)
    {
      /* Leave TERM unchanged.  Set HOME, SHELL, USER, LOGNAME, PATH.
         Unset all other environment variables.  */
      char *term = getenv ("TERM");
      if (term)
	term = xstrdup (term);
      environ = xmalloc ((6 + !!term) * sizeof (char *));
      environ[0] = NULL;
      if (term) {
	xsetenv ("TERM", term, 1);
	free(term);
      }
      xsetenv ("HOME", pw->pw_dir, 1);
      if (shell)
	xsetenv ("SHELL", shell, 1);
      xsetenv ("USER", pw->pw_name, 1);
      xsetenv ("LOGNAME", pw->pw_name, 1);
      set_path(pw);
    }
  else
    {
      /* Set HOME, SHELL, and (if not becoming a superuser)
	 USER and LOGNAME.  */
      if (change_environment)
        {
          xsetenv ("HOME", pw->pw_dir, 1);
	  if (shell)
            xsetenv ("SHELL", shell, 1);
	  if (getlogindefs_bool ("ALWAYS_SET_PATH", 0))
	    set_path(pw);

          if (pw->pw_uid)
            {
              xsetenv ("USER", pw->pw_name, 1);
              xsetenv ("LOGNAME", pw->pw_name, 1);
            }
        }
    }

  export_pamenv ();
}
开发者ID:JohnLih,项目名称:util-linux,代码行数:45,代码来源:su-common.c


示例19: writer

/*
class writer{
    typedef std::vector<std::string> str_vec;
public:
    writer (std::ostream::open_mode mode) : file_mode(mode) {};
    
    
    void set_path();
    void stream(std::string &string_out);
    void stream(std::vector<std::string> &output_vec);

private:
    void set_variables();
    bool valid_path(std::string tempPath);
    std::ostream & write(std::string &output, std::ostream & out);
    std::string path = "null";
    std::ostream::open_mode file_mode;
    int is_set_up = 0;
};*/
void writer::set_variables()
{
    if (is_set_up == 0)
    {
        //set the path
        set_path();
        ++is_set_up;
    }
}
开发者ID:melvincat,项目名称:rabbit_1,代码行数:28,代码来源:writer.cpp


示例20: socket

int BsdAttachListener::init() {
  char path[UNIX_PATH_MAX];          // socket file
  char initial_path[UNIX_PATH_MAX];  // socket file during setup
  int listener;                      // listener socket (file descriptor)

  // register function to cleanup
  ::atexit(listener_cleanup);

  int n = snprintf(path, UNIX_PATH_MAX, "%s/.java_pid%d",
                   os::get_temp_directory(), os::current_process_id());
  if (n < (int)UNIX_PATH_MAX) {
    n = snprintf(initial_path, UNIX_PATH_MAX, "%s.tmp", path);
  }
  if (n >= (int)UNIX_PATH_MAX) {
    return -1;
  }

  // create the listener socket
  listener = ::socket(PF_UNIX, SOCK_STREAM, 0);
  if (listener == -1) {
    return -1;
  }

  // bind socket
  struct sockaddr_un addr;
  addr.sun_family = AF_UNIX;
  strcpy(addr.sun_path, initial_path);
  ::unlink(initial_path);
  int res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr));
  if (res == -1) {
    ::close(listener);
    return -1;
  }

  // put in listen mode, set permissions, and rename into place
  res = ::listen(listener, 5);
  if (res == 0) {
    RESTARTABLE(::chmod(initial_path, S_IREAD|S_IWRITE), res);
    if (res == 0) {
      // make sure the file is owned by the effective user and effective group
      // (this is the default on linux, but not on mac os)
      RESTARTABLE(::chown(initial_path, geteuid(), getegid()), res);
      if (res == 0) {
        res = ::rename(initial_path, path);
      }
    }
  }
  if (res == -1) {
    ::close(listener);
    ::unlink(initial_path);
    return -1;
  }
  set_path(path);
  set_listener(listener);

  return 0;
}
开发者ID:campolake,项目名称:openjdk9,代码行数:57,代码来源:attachListener_bsd.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_pbc函数代码示例发布时间:2022-05-30
下一篇:
C++ set_parent函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap