本文整理汇总了C++中SimpleString::copy_to_c_string方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleString::copy_to_c_string方法的具体用法?C++ SimpleString::copy_to_c_string怎么用?C++ SimpleString::copy_to_c_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleString
的用法示例。
在下文中一共展示了SimpleString::copy_to_c_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EXT_chdir
// ### chdir
Value EXT_chdir(Value arg)
{
Pathname * new_dir = the_pathname(coerce_to_pathname(arg));
SimpleString * namestring = new_dir->namestring();
#ifdef WIN32
if (!SetCurrentDirectory(namestring->copy_to_c_string()))
#else
if (chdir(namestring->copy_to_c_string()) != 0)
#endif
{
String * message = new String();
Pathname * current_dir = the_pathname(EXT_current_directory());
Pathname * merged_pathname = merge_pathnames(new_dir, current_dir, K_newest);
if (EXT_probe_directory(make_value(merged_pathname)) == NIL)
{
if (CL_probe_file(make_value(merged_pathname)) != NIL)
message->append("Not a directory.");
else
message->append("No such file or directory.");
}
else
{
message->append("Unable to change current directory to ");
message->append(::prin1_to_string(make_value(merged_pathname)));
message->append_char('.');
}
return signal_lisp_error(message);
}
char new_current_directory[1024];
#ifdef WIN32
GetCurrentDirectory(sizeof(new_current_directory), new_current_directory);
#else
if (!getcwd(new_current_directory, sizeof(new_current_directory)))
signal_lisp_error("Unable to determine current directory");
#endif
String * s = new String(new_current_directory);
INDEX len = s->length();
if (len > 0 && s->char_at(len - 1) != SEPARATOR_CHAR)
s->append_char(SEPARATOR_CHAR);
return parse_namestring(s);
}