#include <iostream>
#include <fstream>
#include <afx.h>
#include <string>
using namespace std;
int WCharToChar(UINT PageCode, std::wstring strWChar, std::string &strChar);
int findKey(const string key);
int main()
{
CFileFind finder;
// build a string with wildcards
CString propertiesdir("class\\*.properties");
// start working for files
BOOL bWorking = finder.FindFile(propertiesdir);
cout<< bWorking <<endl;
while (bWorking)
{
bWorking = finder.FindNextFile();
CString str = finder.GetFilePath();
CString strName = finder.GetFileName();
cout << str << endl;
string propertiesfile;
string fileName;
WCharToChar( CP_ACP, str.GetBuffer(), propertiesfile);
WCharToChar( CP_ACP, strName.GetBuffer(), fileName);
// cout << propertiesfile << endl;
ifstream infile(propertiesfile.c_str(), ios::in);
if( !infile)
{
cerr<< "oops! unable to open file " <<propertiesfile<<endl;
exit(0);
}
ofstream outfile(("new\\"+fileName).c_str(),ios::out);
if( !outfile)
{
cerr<< "oops! unable to open file" <<"new\\"+propertiesfile<<endl;
}
string textline;
while( getline(infile, textline, '\n'))
{
if(textline=="" || textline.find_first_of("#")==0)
outfile << textline <<endl;
else
{
string::size_type pos = textline.find_first_of("=");
string key = textline.substr(0,pos);
cout<<"key:"<<key<<" find:"<<findKey(key)<<endl;
if(findKey(key) !=0)
{
outfile << textline <<endl;
}
else
{
outfile <<"###"<< textline <<"###"<<endl;
}
}
}
}
finder.Close();
}
int findKey(const string key)
{
CFileFind finder;
// build a string with wildcards
CString jspdir("jsp\\*.jsp");
// start working for files
BOOL bWorking = finder.FindFile(jspdir);
while (bWorking)
{
bWorking = finder.FindNextFile();
CString str = finder.GetFilePath();
string jspfile;
WCharToChar( CP_ACP, str.GetBuffer(), jspfile);
cout << jspfile << endl;
ifstream infile(jspfile.c_str(), ios::in);
if( !infile)
{
cerr<< "oops! unable to open file " <<jspfile<<endl;
exit(0);
}
string textline;
while( getline(infile, textline, '\n'))
{
string::size_type pos = textline.find("\""+key+"\"");
if(pos != string::npos)
{
finder.Close();
return 1;
}
}
}
finder.Close();
return 0;
}
int WCharToChar(UINT PageCode, std::wstring strWChar, std::string &strChar)
{
strChar.clear();
int ret = 0;
int nSize = (int)strWChar.length()*2;
static char pszDest[1024*10];
if( pszDest )
{
memset( pszDest, 0, nSize+1 );
ret = WideCharToMultiByte(PageCode,NULL,strWChar.c_str(),-1,pszDest,nSize,NULL,FALSE);
pszDest[nSize] = '\0';
strChar = pszDest;
}
return ret;
}
分享到:
相关推荐
在MATLAB编程环境中,`getkey`函数是一个非常实用的工具,它允许用户从命令行界面接收键盘输入。这个功能在交互式程序或需要用户反馈的脚本中尤其有用。标题"matlab开发-getkey"指出我们将探讨如何在MATLAB中使用`...
【标题】"GETKEY[键盘记录]"的知识点详解 在IT行业中,键盘记录是一种常见的技术,主要用于监控和记录用户在计算机上输入的所有按键。GETKEY项目显然就是这样一个工具,它利用BHO(Browser Helper Object)来实现...
getkey卡巴斯基各个版本的注册码的下载器
中国裁决文书网getKey()的js文件,略作修改,对未定义方法修改。
本程序可以指定目标文件,将检测到的键盘按键记录到文件中。如果想要结束程序,请通过任务管理器taskmgr。请注意:若您通过本程序盗取他人隐私,作者不负法律责任,谢谢。
配合我的博客文章使用【Python与R协同完成【中国裁判文书网】文书内容爬取】
CH = getkey 等待单个按键并返回 ASCII 代码。 它接受所有ascii字符,包括退格(8),空格(32), 输入(13)等,可以在键盘上输入。 非 ascii 键(ctrl、alt、..)返回 NaN。 CH是双数。 CH = getkey(N) 等待 N 次...
"文书网最新版getKey.js(获取vl5x值)"这个主题涉及到的是一个具体的编程任务,即如何在Python和JavaScript中实现对裁判文书网新更新的vl5x值的获取。vl5x通常是一种动态生成的参数,用于防止非人类的自动化访问,它...
getkey 介绍 getkey.py是Python 3模块,允许用户在键入按键时立即读取按键,而无需按Enter键。 它仅提供一个功能getkey() ,该功能在用户按下某个键之前一直处于阻塞状态。 此函数返回一个2元组,其中包含所按键的...
Key key = keyStore.getKey(alias, "key_password".toCharArray()); PrivateKey privateKey = (PrivateKey) key; ``` 3. 将私钥转换为PEM格式:为了适应Nginx等服务,通常需要将私钥从Java的PKCS8格式转换为PEM格式...
最新上学吧答案获取工具 亲测不限次数查询答案,只需要复制上学吧题目的地址 黏贴到工具中 输入验证答案就可以查询到了。 上学吧答案获取工具!!! 上学吧答案获取工具!!! 上学吧答案获取工具!!! 亲测可用!...
配合我的博客文章使用【Python与R协同完成【中国裁判文书网】文书内容爬取】
然后定义一个`getKey`方法,该方法接受一个值作为参数,其目的是找到与该值相匹配的所有键。 方法的核心在于调用`entrySet()`方法,它返回一个包含HashMap中所有映射关系(Entry)的Set集合。每个Map.Entry对象代表...
if (Input.GetKey ("down") || Input.GetKey(KeyCode.S)) { transform.Translate(0, 0, 5 * Time.deltaTime); } // 上移 if (Input.GetKey ("up") || Input.GetKey(KeyCode.W)) { transform.Translate(0, 0, -...
queryBuilder.append(URLEncoder.encode(entry.getKey(), "UTF-8")); queryBuilder.append('='); queryBuilder.append(URLEncoder.encode(entry.getValue(), "UTF-8")); } URI fullUri = new URI(urlBase + "?" ...
"key.dll"可能是一个包含特定功能或服务的库文件,而"GetKey.exe"则可能是依赖于"key.dll"的可执行程序,用于执行某些特定的操作,比如获取密钥或者进行加密解密等安全相关的任务。理解DLL的工作原理和管理方式对于...
GET key value(获取key的值) GETRANGE key m,n(获取key的值的[m,n]的子字符) GETSET key value(重新设置key的值,并返回旧值) MGET key1[key2...](获取一个或多个key的值) SETEX key seconds value(将key值设...
View v = (View) entry.getKey(); v.setOnClickListener(null); } } private void registerLisntener(){ for(Map.Entry,Object> entry:data.entrySet()){ View v = (View) entry.getKey(); ...
- **额外考虑**:如果使用BRO策略,需要考虑条件`V[i].getKey() < pivot.getKey() && ++k != i`的所有组合情况。例如: - 条件`V[i].getKey() < pivot.getKey()`为真,`++k != i`也为真。 - 条件`V[i].getKey() ...
var getKeyValue = require('get-js-object-key-value') getKeyValue(对象: JSObject ) JSObject可以是具有一个或多个属性的对象 返回 一个属性应该返回一个带有{key, value}的js 对象 多个属性应该返回一个...