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

C++ searchpath函数代码示例

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

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



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

示例1: Write_System_Files

/* Write System Files */
void Write_System_Files(void)
{
  char * syspath = NULL;
  char sysarg0[3] = { 'x', ':', 0 };
  int retval;

#if defined(__TURBOC__)
  /* Check for the sys command. */
  syspath = searchpath("sys.com");
  if (syspath == NULL)
    syspath = searchpath("sys.exe");
  if (syspath == NULL)
  {
    printf("\nWARNING: No SYS in PATH - could not install system files!\n");
    return;
  }

  sysarg0[0] = param.drive_letter[0];
  printf("\nRunning SYS: %s %s\n", syspath, sysarg0);
  retval = spawnl(P_WAIT, syspath, syspath, sysarg0, NULL);
#else
  /* use less efficient / less safe style with a new shell: */
  /* Issue the command to write system files. */
  char sys[7] = {'s','y','s',' ','x',':',0};
  sys[4] = param.drive_letter[0];
  printf("\nRunning SYS in a shell: %s\n", sys);
  retval = system(sys);
#endif

  if (retval > 0) printf("\nSYS returned errorlevel %d.\n", retval);
  if (retval < 0) printf("\nWARNING: Running SYS failed.\n");
} /* Write_System_Files */
开发者ID:FDOS,项目名称:format,代码行数:33,代码来源:main.c


示例2: getGvimName

//
// Get the name of the Gvim executable to use, with the path.
// When "runtime" is non-zero, we were called to find the runtime directory.
// Returns the path in name[BUFSIZE].  It's empty when it fails.
//
    static void
getGvimName(char *name, int runtime)
{
    HKEY	keyhandle;
    DWORD	hlen;

    // Get the location of gvim from the registry.
    name[0] = 0;
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
				       KEY_READ, &keyhandle) == ERROR_SUCCESS)
    {
	hlen = BUFSIZE;
	if (RegQueryValueEx(keyhandle, "path", 0, NULL, (BYTE *)name, &hlen)
							     != ERROR_SUCCESS)
	    name[0] = 0;
	else
	    name[hlen] = 0;
	RegCloseKey(keyhandle);
    }

    // Registry didn't work, use the search path.
    if (name[0] == 0)
	strcpy(name, searchpath((char *)"gvim.exe"));

    if (!runtime)
    {
	// Only when looking for the executable, not the runtime dir, we can
	// search for the batch file or a name without a path.
	if (name[0] == 0)
	    strcpy(name, searchpath((char *)"gvim.bat"));
	if (name[0] == 0)
	    strcpy(name, "gvim");	// finds gvim.bat or gvim.exe
    }
}
开发者ID:mischief,项目名称:vim,代码行数:39,代码来源:gvimext.cpp


示例3: read_ini

void read_ini(void)
{char name[60],*path;
 printf("Reading the INI file . . .          ");
 GetPath(name,CMD);
 strcat(name,INI_NAME);
 if ((ini_file=fopen(name,"r"))!=NULL)
 {ini_find=1,ini_open=1;
  strcpy(INI_PATH,name);
 }
 else
 {path=searchpath(INI_NAME);
  if (path==NULL)
   ini_find=0,ini_open=0;
  else
  {ini_file=fopen(path,"r");
   ini_find=1,ini_open=1;
   strcpy(INI_PATH,path);
  }
 }
 if (ini_open)
  ReadINI();
 else
 {strcpy(HZK,"C:\\HREADER\\HZK16");
  strcpy(LABEL_PATH,"C:\\HREADER\\LABEL\\");
  strcpy(TEMP_PATH,"C:\\HREADER\\TEMP\\");
  History=0;
 }
 fclose(ini_file);
}
开发者ID:hex-ci,项目名称:Hyper-Reader,代码行数:29,代码来源:HRINI.C


示例4: system

int _RTL_FUNC system(const char *string)
{
    FILE *f;
    char buf[1024],*a;
    a = getenv("COMSPEC");
    if (!a)
        a = searchpath("cmd.exe");
    if (!string) {
        if (!a)
            return 0;
        else
            if (f = fopen(a,"r")) {
                fclose(f);
                return 1;
            }
            else
                return 0;
    }
    if (!a) {
        errno = ENOENT;
        return -1;
    }
    buf[0] = ' ';
    buf[1] = '/';
    buf[2] = 'C';
    buf[3] = ' ';
    strcpy(buf+4,string);
    return spawnlp(P_WAIT,a,a,buf,0);
}
开发者ID:doniexun,项目名称:OrangeC,代码行数:29,代码来源:system.c


示例5: spawnbase

static int spawnbase(const char *path, const char *args[], 
			const char *env[], int toexit, int tosearch)
{
	FILE *fil;
  int rv;
	char name[260],*vv;
	char parms[1024];
	parms[0] = ' ';
	parms[1] = 0;
	if (*args)
	{
	   while (*++args) {
	      strcat(parms," ") ;
			strcat(parms,*args);
	   }
	}
	strcpy(name,path);
	if (tosearch)
	{
		if (!(vv = searchpath(name))) {
			strcat(name,".EXE");
			if (!(vv = searchpath(name))) {
				strcpy(name,path);
				strcat(name,".COM");
				if (!(vv = searchpath(name))) {
		            errno = ENOENT;
		            return -1 ;
				}
			}
		}
	}
	else
	{
		int h = open(name, O_RDONLY);
		if (h == -1) {
			errno = ENOENT;
			return -1;
		}
		close(h);
		vv = name;
	}
   fflush(0) ;
   rv = __ll_spawn(vv,parms,env,toexit);
	if (toexit == P_OVERLAY)
		exit(rv);
	return rv;
}
开发者ID:doniexun,项目名称:OrangeC,代码行数:47,代码来源:spawn.c


示例6: iterator

media_auditor::summary media_auditor::audit_samples()
{
	// start fresh
	m_record_list.reset();

	int required = 0;
	int found = 0;

	// iterate over sample entries
	samples_device_iterator iterator(m_enumerator.config().root_device());
	for (samples_device *device = iterator.first(); device != nullptr; device = iterator.next())
	{
		// by default we just search using the driver name
		std::string searchpath(m_enumerator.driver().name);

		// add the alternate path if present
		samples_iterator iter(*device);
		if (iter.altbasename() != nullptr)
			searchpath.append(";").append(iter.altbasename());

		// iterate over samples in this entry
		for (const char *samplename = iter.first(); samplename != nullptr; samplename = iter.next())
		{
			required++;

			// create a new record
			audit_record &record = m_record_list.append(*global_alloc(audit_record(samplename, audit_record::MEDIA_SAMPLE)));

			// look for the files
			emu_file file(m_enumerator.options().sample_path(), OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD);
			path_iterator path(searchpath.c_str());
			std::string curpath;
			while (path.next(curpath, samplename))
			{
				// attempt to access the file (.flac) or (.wav)
				osd_file::error filerr = file.open(curpath.c_str(), ".flac");
				if (filerr != osd_file::error::NONE)
					filerr = file.open(curpath.c_str(), ".wav");

				if (filerr == osd_file::error::NONE)
				{
					record.set_status(audit_record::STATUS_GOOD, audit_record::SUBSTATUS_GOOD);
					found++;
				}
				else
					record.set_status(audit_record::STATUS_NOT_FOUND, audit_record::SUBSTATUS_NOT_FOUND);
			}
		}
	}

	if (found == 0 && required > 0)
	{
		m_record_list.reset();
		return NOTFOUND;
	}

	// return a summary
	return summarize(m_enumerator.driver().name);
}
开发者ID:RJRetro,项目名称:mame,代码行数:59,代码来源:audit.cpp


示例7: lua_getfield

	static const char *findfile(lua_State *L, const char *name, const char *pname, bool is_local) {
		const char *path;
		lua_getfield(L, lua_upvalueindex(1), pname);
		path = lua_tostring(L, -1);
		if (path == NULL)
			luaL_error(L, "`package.%s` must be a string", pname);
		return searchpath(L, name, path, ".", LUA_DIRSEP, is_local);
	}
开发者ID:actboy168,项目名称:YDWE,代码行数:8,代码来源:libs_package.cpp


示例8: lua_getfield

	static const char *findfile(lua_State *L, const char *name, const char *pname, const char *dirsep, bool is_local) {
		const char *path;
		lua_getfield(L, lua_upvalueindex(1), pname);
		path = lua_tostring(L, -1);
		if (path == NULL)
			luaL_error(L, LUA_QL("package.%s") " must be a string", pname);
		return searchpath(L, name, path, "\0", dirsep, is_local);
	}
开发者ID:l327253678,项目名称:YDWE,代码行数:8,代码来源:libs_package.cpp


示例9: smtpdial

/* Taken from imapdial, replaces tlsclient call with stunnel */
static int
smtpdial(char *server)
{
	int p[2];
	int fd[3];
	char *tmp;
	char *fpath;

	if(pipe(p) < 0)
		return -1;
	fd[0] = dup(p[0], -1);
	fd[1] = dup(p[0], -1);
	fd[2] = dup(2, -1);
#ifdef PLAN9PORT
	tmp = smprint("%s:587", server);
	fpath = searchpath("stunnel3");
	if (!fpath) {
		werrstr("stunnel not found. it is required for tls support.");
		return -1;
	}
	if(threadspawnl(fd, fpath, "stunnel", "-n", "smtp" , "-c", "-r", tmp, nil) < 0) {
#else
	tmp = smprint("tcp!%s!587", server);
	if(threadspawnl(fd, "/bin/tlsclient", "tlsclient", tmp, nil) < 0){
#endif
		free(tmp);
		close(p[0]);
		close(p[1]);
		close(fd[0]);
		close(fd[1]);
		close(fd[2]);
		return -1;
	}
	free(tmp);
	close(p[0]);
	return p[1];
}

int
mxdial(char *addr, char *ddomain, char *gdomain)
{
	int fd;
	DS ds;
	char err[Errlen];

	addr = netmkaddr(addr, 0, "smtp");
	dial_string_parse(addr, &ds);

	/* try connecting to destination or any of it's mail routers */
	fd = callmx(&ds, addr, ddomain);

	/* try our mail gateway */
	rerrstr(err, sizeof(err));
	if(fd < 0 && gdomain && strstr(err, "can't translate") != 0)
		fd = dial(netmkaddr(gdomain, 0, "smtp"), 0, 0, 0);

	return fd;
}
开发者ID:9fans,项目名称:plan9port,代码行数:59,代码来源:mxdial.c


示例10: main

void main (int argc, char *argv[])
{
    char *caminho;

    if (caminho = searchpath("relatorio.txt"))
        printf ("Caminho do arquivo: %s\n", caminho);
    else
        printf ("Arquivo nao encontrado\n");
}
开发者ID:leonardoapolinario,项目名称:C-And-C-Plus-Plus-Bible,代码行数:9,代码来源:pesquisaocaminhodecomandos_localizacaodeumarquivo.c


示例11: ll_searchpath

static int ll_searchpath (lua_State *L) {
  const char *f = searchpath(L, luaL_checkstring(L, 1), luaL_checkstring(L, 2));
  if (f != NULL) return 1;
  else {  /* error message is on top of the stack */
    lua_pushnil(L);
    lua_insert(L, -2);
    return 2;  /* return nil + error message */
  }
}
开发者ID:BackupTheBerlios,项目名称:rsxplusplus-svn,代码行数:9,代码来源:loadlib.c


示例12: lua_getfield

static const char *findfile(lua_State *L, const char *name,
			    const char *pname)
{
  const char *path;
  lua_getfield(L, LUA_ENVIRONINDEX, pname);
  path = lua_tostring(L, -1);
  if (path == NULL)
    luaL_error(L, LUA_QL("package.%s") " must be a string", pname);
  return searchpath(L, name, path, ".", LUA_DIRSEP);
}
开发者ID:qyqx,项目名称:BerryBots,代码行数:10,代码来源:lib_package.c


示例13: lua_getfield

static const char *findfile (lua_State *L, const char *name,
                                           const char *pname,
                                           const char *dirsep) {
  const char *path;
  lua_getfield(L, lua_upvalueindex(1), pname);
  path = lua_tostring(L, -1);
  if (path == NULL)
    luaL_error(L, "'package.%s' must be a string", pname);
  return searchpath(L, name, path, ".", dirsep);
}
开发者ID:littlesome,项目名称:xLua,代码行数:10,代码来源:loadlib.c


示例14: applyBinding

	void applyBinding(lua_State * L) {

		// Connect LuaBind to this state
		try {
			luabind::open(L);
			luabind::bind_class_info(L);
		} catch (const std::exception & e) {
			std::cerr << "Caught exception connecting luabind and class_info: " << e.what() << std::endl;
			throw;
		}

		/// Apply our bindings to this state

		// Extend the lua script search path for "require"
		LuaPath& lp = LuaPath::instance();
		{
			LuaSearchPathUpdater searchpath(L);
			searchpath.extend(SearchDirectory(lp.getLuaDir()));
			searchpath.extend(RootDirectory(lp.getRootDir()));
		}

		{
			/// @todo c search path
			//LuaCSearchPathUpdater csearchpath(L);
		}


		// osgLua
		bindOsgToLua(L);

		// vrjugglua
		bindKernelToLua(L);
		bindSonixToLua(L);
		bindGadgetInterfacesToLua(L);
		bindRunBufferToLua(L);
		BindvrjLuaToLua(L);

		OsgAppProxy::bindToLua(L);

		// Set up traceback...
		luabind::set_pcall_callback(&add_file_and_line);

		// Load the vrjlua init script
		luabind::globals(L)["require"]("vrjlua-init");

		// set up global for debug mode
		/// @todo make this work
/*
		luabind::module(L.get(), "vrjlua")[
		                                        luabind::def_readwrite(boost::ref(LuaScript::exitOnError))
											   ];

*/
	}
开发者ID:lpberg,项目名称:vr-jugglua,代码行数:54,代码来源:ApplyBinding.cpp


示例15: ll_searchpath

static int ll_searchpath (lua_State *L) {
  const wchar_t *f = searchpath(L, luaL_checkstring(L, 1),
                                   check_utf8_string(L, 2, NULL),
                                   opt_utf8_string(L, 3, L"."),
                                   opt_utf8_string(L, 4, LUA_DIRSEP));
  if (f != NULL) return 1;
  else {  /* error message is on top of the stack */
    lua_pushnil(L);
    lua_insert(L, -2);
    return 2;  /* return nil + error message */
  }
}
开发者ID:gvsurenderreddy,项目名称:LuaFAR,代码行数:12,代码来源:uloadlib52.c


示例16: lua_getfield

static const wchar_t *findfile (lua_State *L, const char *name,
                                              const char *pname,
                                              const wchar_t *dirsep) {
  const wchar_t *path;
  lua_getfield(L, lua_upvalueindex(1), pname);
  if (lua_tostring(L, -1) == NULL)
    luaL_error(L, LUA_QL("package.%s") " must be a string", pname);
  path = utf8_to_utf16(L, -1, NULL);
  if (path == NULL)
    luaL_error(L, LUA_QL("package.%s") " contains invalid UTF-8", pname);
  return searchpath(L, name, path, L".", dirsep);
}
开发者ID:gvsurenderreddy,项目名称:LuaFAR,代码行数:12,代码来源:uloadlib52.c


示例17: Write_System_Files

/* Write System Files */
static void Write_System_Files(void)
{
	int sys_found = FALSE;
	char sys[9] = {'s','y','s',' ','x',':',13,0,0};

	/* Check for the sys command. */
	if (NULL!=searchpath("sys.com") ) sys_found = TRUE;
	if (NULL!=searchpath("sys.exe") ) sys_found = TRUE;

	if (sys_found==TRUE)
	{
		/* Issue the command to write system files. */
		sys[4]=param.drive_letter[0];
		printf("\nRunning SYS command: %s\n",sys);
		system(sys);
	}
	else
	{
		printf("\n Error:  The SYS command has not been located.\n");
		printf(  "         System files have not be written to the disk.\n");
	}
}
开发者ID:svn2github,项目名称:freedos-32,代码行数:23,代码来源:main.c


示例18: lj_cf_package_searchpath

static int lj_cf_package_searchpath(lua_State *L)
{
  const char *f = searchpath(L, luaL_checkstring(L, 1),
				luaL_checkstring(L, 2),
				luaL_optstring(L, 3, "."),
				luaL_optstring(L, 4, LUA_DIRSEP));
  if (f != NULL) {
    return 1;
  } else {  /* error message is on top of the stack */
    lua_pushnil(L);
    lua_insert(L, -2);
    return 2;  /* return nil + error message */
  }
}
开发者ID:qyqx,项目名称:BerryBots,代码行数:14,代码来源:lib_package.c


示例19: main

/*************************************************
	Function: 		main
	Description: 	主函数
	Calls: 			scanf	printf
	Called By:		编译器
	Input: 			无
	Output: 		无
	Return: 		0
*************************************************/
int main(void)
{
	char *ptr = NULL;
	char filename[20];
	printf("input the file name:\n");
	scanf("%s", filename);
	if ((ptr = searchpath(filename)) != NULL)
	{
		printf("%s", ptr);
	}
	else
	{
		printf("no the file!\n");
	}
}
开发者ID:noparkinghere,项目名称:C_test,代码行数:24,代码来源:192.c


示例20: main

void main() {
    char *p,*a,q[100];

    strcpy (q,"link.exe");
    p = searchpath (q);   /* El valor de q no cambia */
    if (p == NULL) {
        a = _strerror ("Error en searchpath ()");
        PRS(a);
        getch();
        exit (1);
    }
    PRS(p);
    SALTO;
    getch();
}
开发者ID:agudeloandres,项目名称:C_Struct_Files,代码行数:15,代码来源:P233.CPP



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ searpc_client_call__int函数代码示例发布时间:2022-05-30
下一篇:
C++ searcher函数代码示例发布时间: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