string反向找位置,分割字符串(只取文件夹路径)
1 #include <uf.h>
2 #include <uf_part.h>
3 #include <atlstr.h>
4 #include <iostream>
5 #include <sstream>
6
7 using std::string;
8
9
10 UF_initialize();
11
12 //获取当前part的tag
13 tag_t WorkPart = UF_PART_ask_display_part();
14
15 //获取当前part所在路径
16 char part_fspec[MAX_FSPEC_BUFSIZE+1];
17 UF_PART_ask_part_name(WorkPart, part_fspec);
18
19 //反向找位置,分割字符串(只取文件夹路径)
20 string strPath = part_fspec;
21 string strDir;
22 int nPos = strPath.find_last_of('\\');
23 if (string::npos != nPos)
24 {
25 strDir = strPath.substr(0, nPos);
26 }
27
28 //方法1
29 //转换
30 //char msg[256];
31 //sprintf_s(msg, "start %s", strDir.c_str());
32
33 //打开并显示文件夹(windows cmd)
34 //system(msg);
35
36 //方法2
37 //ShellExecute打开一个文件
38 //ShellExecute(NULL, "open", "C:\\11.txt", NULL, NULL, SW_SHOWNORMAL);
39
40 ////ShellExecute打开并显示文件夹
41 ShellExecute(NULL, "open", strDir.c_str(), NULL, NULL, SW_SHOWNORMAL);
42
43 UF_terminate();

string反向找位置,分割字符串(只取文件夹路径)的更多相关文章
- python实现将大文件夹分割成多个子文件夹
楼主用的linux,一旦数据达到几万,文件夹打开就会变卡,同时也方便同时分工协作,便于git管理,写了个将大文件夹分割成多个小文件夹的脚本 如操作文件夹:img,脚本不破坏img的数据,创建img_1 ...
- 找关键字,分割字符串,输出一个vector
vector<string> split(const string& str, const string& delim) { vector<string> re ...
- java.lang.string split 以点分割字符串无法正常拆分字符串
//错误的做法String ip="192.168.11.23"; String[] spstr_IP=ip.split(".");//这种方式无法拆分在ip字 ...
- C 语言简历一个文件夹 并自己输入字符 来取文件夹名字
int main(void) { FILE *fp; char ch,filename[10]; scanf("%s",filename); if((fp=fopen(filena ...
- WinRAR打包时不包含文件夹本身,只打包文件夹里的文件和目录
加上-ep1 参数即可. rar u -m3 -s -r -o+ -ep1 -x*.zip client_zmv9.zip ".\client_zmv9\*"
- idea web项目启动失败的情况---webapp文件夹路径不对,应如图位置
- python----获取文件的路径(各种方式)
#获取到当前文件的上个文件夹目录ABSPATH = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) #获取的是相对路径FRON ...
- 找不到/lib/modules/../build文件夹
:解决了make: *** /lib/modules/3.2.0-4-amd64/build: 没有那个文件或目录的问题,更新一下软件列表,然后sudo apt-get install linux-h ...
- 2018-8-10-win10-uwp-获取文件夹出错
title author date CreateTime categories win10 uwp 获取文件夹出错 lindexi 2018-08-10 19:16:50 +0800 2018-2-1 ...
随机推荐
- Add cast to是什么意思
eclipse中是强制类型转换的意思.
- Mysql安装多版本数据库
1.下载对应版本压缩包 2.解压缩文件 3.到解压缩文件,添加my.ini文件,修改相关的配置,如端口,文件路径等 # For advice on how to change settings ple ...
- Delphi 滚动条的使用
DELPHI的滚动条默认发送消息格式: function TControl.Perform( Msg: Cardinal; WParam: WPARAM; LParam: LPARAM): LRESU ...
- v-on 绑定单个或多个事件
<div id="app07"> <!-- v-on:click 鼠标点击事件--> <a v-on:click="DoSomething& ...
- Dart编程实例 - Final 关键字
Dart编程实例 - Final 关键字 void main() { final val1 = 12; print(val1); } 本文转自:http://codingdict.com/articl ...
- 【基础】Pipeline
1. 参考的优秀文章 Request/Response protocols and RTT 2. 来源 原来,系统中一个树结构的数据来源是Redis,由于数据增多.业务复杂,查询速度并不快.究其原因, ...
- jquery基础知识实例(一)
轮滑 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o ...
- Yii2中自定义表单样式
use yii\widgets\ActiveForm; <?php $form = ActiveForm::begin([ 'options' => ['class' => 'for ...
- RestHighLevelClient客户端相关CURD操作
客户端连接 public void start() { try { restHighLevelClient = new RestHighLevelClient( RestClient.builder( ...
- tp5.1 模型 where多条件查询 like 查询 --多条件查询坑啊!!(tp5.1与tp5.0初始化控制器不一样)
tp5.1与tp5.0初始化控制器不一样!!!!!!!!!! 多条件 where必须 new where() ---------------------------------------tp5.1 ...