请教_tmkdir新建一个目录失败的问题

gaoshihonglincheng 2004-09-29 08:20:41
在使用.net运行库的_tmkdir新建一个目录时,如在c:\ps\根目录下新建一个名为“新建一个目录.ps”的目录时,
如果使用_tmkdir("c:\ps\新建一个目录.ps")则成功,
如果使用下面的方式则失败,
char path[266];
lstrcpy(path,"c:\ps\新建一个目录.ps");
_tmkdir(path);
请问该如果解决这个问题?

...全文
259 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
kugou123 2004-09-29
  • 打赏
  • 举报
回复
不会这么奇怪吧。。
gaoshihonglincheng 2004-09-29
  • 打赏
  • 举报
回复
是我发帖的笔误,我是使用的 "c:\\ps\\新建一个目录.ps" 这样的格式的;使用CSDN的那种样式可以,但是如果在目录中加入"."就不行了
Kudeet 2004-09-29
  • 打赏
  • 举报
回复
你的目录都应该是\\,在VC里路径都是这样表示的:c:\\...\\
Kudeet 2004-09-29
  • 打赏
  • 举报
回复
copied from MSDN:


_mkdir, _wmkdir
Create a new directory.

int _mkdir( const char *dirname );

int _wmkdir( const wchar_t *dirname );

Routine Required Header Compatibility
_mkdir <direct.h> Win 95, Win NT
_wmkdir <direct.h> or <wchar.h> Win NT


For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version


Return Value

Each of these functions returns the value 0 if the new directory was created. On an error the function returns –1 and sets errno as follows:

EEXIST

Directory was not created because dirname is the name of an existing file, directory, or device

ENOENT

Path was not found

Parameter

dirname

Path for new directory

Remarks

The _mkdir function creates a new directory with the specified dirname. _mkdir can create only one new directory per call, so only the last component of dirname can name a new directory. _mkdir does not translate path delimiters. In Windows NT, both the backslash ( \) and the forward slash (/ ) are valid path delimiters in character strings in run-time routines.

_wmkdir is a wide-character version of _mkdir; the dirname argument to _wmkdir is a wide-character string. _wmkdir and _mkdir behave identically otherwise.

Generic-Text Routine Mappings

TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_tmkdir _mkdir _mkdir _wmkdir


Example

/* MAKEDIR.C */

#include <direct.h>
#include <stdlib.h>
#include <stdio.h>

void main( void )
{
if( _mkdir( "\\testtmp" ) == 0 )
{
printf( "Directory '\\testtmp' was successfully created\n" );
system( "dir \\testtmp" );
if( _rmdir( "\\testtmp" ) == 0 )
printf( "Directory '\\testtmp' was successfully removed\n" );
else
printf( "Problem removing directory '\\testtmp'\n" );
}
else
printf( "Problem creating directory '\\testtmp'\n" );
}


Output

Directory '\testtmp' was successfully created
Volume in drive C is CDRIVE
Volume Serial Number is 0E17-1702

Directory of C:\testtmp

05/03/94 12:30p <DIR> .
05/03/94 12:30p <DIR> ..
2 File(s) 0 bytes
17,358,848 bytes free
Directory '\testtmp' was successfully removed

Directory Control Routines

See Also _chdir, _rmdir
内容概要:本文研究了基于DPWMA调制、正负序分离锁相与电网电压前馈控制的一体化控制策略在ANPC三电平并网逆变器中的应用。通过分析ANPC拓扑的结构优势,提出结合双极性倍频脉宽调制(DPWMA)以提升输出波形质量,降低谐波含量;采用正负序分离锁相技术应对电网电压不平衡问题,确保相位同步精度;引入电网电压前馈控制克服传统闭环反馈的滞后性,增强系统对电压骤升、骤降等动态扰动的响应能力。整体控制架构分为信号采集、核心控制与调制驱动三层,实现“精准同步-扰动补偿-优质调制”的协同优化。经仿真验证,该复合控制策略在稳态、不平衡及动态工况下均表现出优异的电能质量、稳定性和抗扰性能。; 适合人群:从事电力电子、新能源并网、逆变器控制等相关领域的科研人员及工程技术人员,具备一定电力系统与控制理论基础的研究生或高年级本科生。; 使用场景及目标:① 提升高功率并网逆变器在复杂电网环境下的运行稳定性与电能质量;② 解决电网电压不平衡、畸变、突变等工况下的锁相失真与电流畸变问题;③ 实现快速动态响应与高精度并网控制,适用于新能源发电、工业变流等实际工程场景。; 阅读建议:建议结合Simulink仿真模型进行实践验证,重点关注DPWMA调制实现、正负序分离算法设计与前馈控制环节的参数整定,深入理解各模块间的协同机制,并通过对比实验体会复合控制策略相对于传统方法的性能优势。

16,550

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧