问题描述
- C++编程,文件路径保存在txt文件里,如果删除实现按路径删除
-
开发环境 vs2010
扫描C盘的tmp文件扫描后把文件路径保存在txt文件里如果删除实现按路径删除
txt是unicode编码的,#include "stdafx.h"
#include
#include
#include
#include
#includeusing namespace std;
#define STR_SAVETEMPFILEINFO_FILENAME L"C:alltemp.txt" // 用于存储垃圾文件信息的文件
int _tmain(int argc, _TCHAR* argv[])
{
_wsetlocale(LC_ALL,L"chs");ifstream fs; string line; string temp; int n = 0; int num = 0; //stringstream ss; fs.open(STR_SAVETEMPFILEINFO_FILENAME, ifstream::binary); if(!fs.is_open()) { cout<<"不能打开文件"<<endl; return 1; } while (getline(fs, line)) { //ss.str(line); n = line.rfind(':'); temp = line.substr(n+1); cout<<temp<<endl; } getchar(); return 0;
}
我想用里面的路径 但是用不了都是空格 我已经用二进制的方式打开了 哪位大侠帮忙看下 谢谢了
时间: 2024-08-02 13:41:31