23 windows_22_windows_Directory 文件系统 - 目录
2016-06-10 10:38
453 查看
windows_22_windows_Directory 文件系统 - 目录
[/code]
来自为知笔记(Wiz)
// windows_22_windows_Directory.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <windows.h>
void UseDirectory( )
{
//创建目录
CreateDirectory( "D:\\Test", NULL );
//删除目录
RemoveDirectory( "D:\\Test2" );
//修改文件或者文件夹名称
MoveFile( "d:\\Test", "d:\\Test2" );
}
void ShowDirectory( )
{
//获取Windows目录
CHAR szWindows[MAX_PATH] = { 0 };
GetWindowsDirectory( szWindows, MAX_PATH );//当前系统安装目录
printf( "WindowsDirectory: %s\n", szWindows );
//获取System目录
CHAR szSystem[MAX_PATH] = { 0 };
GetSystemDirectory( szSystem, MAX_PATH );
printf( "SystemDirectory: %s\n", szSystem );
//获取临时文件的路径
CHAR szTemp[MAX_PATH] = { 0 };
GetTempPath( MAX_PATH, szTemp );
printf( "TempPath: %s\n", szTemp );
//获取应用程序当前目录
CHAR szCurrent[MAX_PATH] = {0};
GetCurrentDirectory( MAX_PATH, szCurrent );
printf( "CurrentDirectory: %s\n", szCurrent );
//设置当前目录
SetCurrentDirectory( "c:\\" );
GetCurrentDirectory( MAX_PATH, szCurrent );
printf( "CurrentDirectory: %s\n", szCurrent );
}
int _tmain(int argc, _TCHAR* argv[])
{
ShowDirectory( );
UseDirectory( );
return 0;
}
[/code]
来自为知笔记(Wiz)
相关文章推荐
- Qt代码段2
- 1226 倒水问题
- json_decode详解
- 第二阶段冲刺第一天
- Android编码规范
- algorithm 题集四 (16.06.10)
- windows 桌面/desktop 及 MessageBox(MB_TOPMOST)
- 传递额外的值 Passing Extra Values |在视图中生成输出URL | 高级路由特性 | 精通ASP-NET-MVC-5-弗瑞曼
- Ecshop IIS Rewrite伪静态规则
- Spring Mvc那点事---(11)Spring Mvc之mybatis增删改查
- 学生常见问题(三)
- 彻底解决 ECSHOP缩略图 ECSHOP商品图片 不清晰的方法,最新解决办法
- ecshop商品页显示累计销售量,ecshop显示商品销售总数量的方法
- I00021 有负数项的数列之和
- hdu 1728(搜索)
- 今天在技术上有一点成就感
- 单目ORB_SLAM 实战
- Java如何播放音频文件,4行代码帮你搞定(不,1行)!
- 富文本
- ecshop首页显示折扣的方法,ecshop商品显示折扣的方法