社区
工具平台和程序库
帖子详情
wifstream问题!高人指教
firingme
2003-04-09 11:15:45
#include <fstream>
using namespace std;
int main()
{
wifstream dict(L"abc") ;
return 1 ;
}
请哪位高人指教这段代码该如何修改?
Vc7和Dev-C++都编译不通过。
...全文
74
2
打赏
收藏
wifstream问题!高人指教
#include using namespace std; int main() { wifstream dict(L"abc") ; return 1 ; } 请哪位高人指教这段代码该如何修改? Vc7和Dev-C++都编译不通过。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
突击召唤师
2003-04-09
打赏
举报
回复
dict(L"abc")
这句话没问题么?
merlinran
2003-04-09
打赏
举报
回复
老兄:
wifstream只是表示从里面读出的是wchar_t,但构造函数中传递文件名时,仍然应该用char *
层次路径递归创建文件实例
// // FilePath.h // /** \file FilePath.h */ #pragma once #include "vtString.h" #include
#include
/** * A portable class for reading directory contents. * * Example of use: \code for (dir_iter it("C:/temp"); it != dir_iter(); ++it) { if (it.is_hidden()) continue; if (it.is_directory()) printf("Directory: '%s'\n", it.filename().c_str()); else printf("File: '%s'\n", it.filename().c_str()); } \endcode */ class dir_iter { public: dir_iter(); dir_iter(const char*dirname); dir_iter(const wchar_t*dirname); ~dir_iter(); /// Returns true if the current object is a directory. bool is_directory(); /// Returns true if the current object is hidden. bool is_hidden(); /// Get the filename fo the current object. std::string filename(); std::wstring wfilename(); // Iterate the object to the next file/directory. void operator++(); // Test for inequality useful to test when iteration is finished. bool operator!=(const dir_iter ⁢); long m_handle; private: struct _wfinddata_t m_data; }; //MBCS string 或者 Wide string vtString vtFindFileOnPaths(const vtStringArray &paths;, const char *filename); vtString2 vtFindFileOnPaths(const vtStringArray2 &paths;, const wchar_t *filename); bool vtCreateDir(const char *dirname); bool vtCreateDir(const wchar_t *dirname); void vtDestroyDir(const char *dirname); void vtDestroyDir(const wchar_t *dirname); int vtDeleteFile(const char *filename); int vtDeleteFile(const wchar_t *filename); const char *vtStartOfFileName(const char *szFullPath); const wchar_t *vtStartOfFileName(const wchar_t *szFullPath); vtString vtExtractPath(const char *szFullPath, bool bTrailingSlash); vtString2 vtExtractPath(const wchar_t *szFullPath, bool bTrailingSlash); bool vtPathIsAbsolute(const char *szPath); bool vtPathIsAbsolute(const wchar_t *szPath); vtString vtPathLevelUp(const char *src); vtString2 vtPathLevelUp(const wchar_t *src); vtString get_line_from_stream(std::
ifstream
&input;); vtString2 get_line_from_stream(std::w
ifstream
&input;); //bFull为ture包括所有扩展名;否则最后一个扩展名 void vtRemoveFileExtensions(vtString& fname,bool bFull = false); void vtRemoveFileExtensions(vtString2& fname,bool bFull = false); //bFull为ture包括所有扩展名;否则最后一个扩展名 vtString vtGetExtensions(const vtString &fname;, bool bFull = false); vtString2 vtGetExtensions(const vtString2 &fname;, bool bFull = false); bool vtChangeFileExtension(vtString& input, const char *extension); bool vtChangeFileExtension(vtString2& input, const wchar_t *extension); bool vtFileExists(const char *fname); bool vtFileExists(const wchar_t *fname); #pragma comment(lib, "shell32.lib") bool vtCopyFile( const char* from,const char * to, bool bFailIfExists=true); bool vtCopyFile( const wchar_t* from,const wchar_t * to, bool bFailIfExists=true); bool vtCopyTree(const char* from,const char * to); bool vtCopyTree(const wchar_t* from,const wchar_t * to); bool vtFolderExists(const char *fname); bool vtFolderExists(const wchar_t *fname); bool vtFilePathExists(const char *fname); bool vtFilePathExists(const wchar_t *fname); int vtGetFileSize(const char *fname); int vtGetFileSize(const wchar_t *fname); void vtSetEnvironmentVar(const char* var, const char*value); void vtSetEnvironmentVar(const wchar_t* var, const wchar_t*value); #include "windows.h" bool vtGetModuleFullPath(const char* modulename,vtString& fullpath); bool vtGetModuleFullPath(const wchar_t* modulename,vtString2& fullpath); ///////////////////////////////////////////// // Open a file using a UTF-8 or wide character filename. FILE *vtFileOpen(const char *fname_mbcs, const char *mode); FILE *vtFileOpen(const wchar_t *fname_wide, const wchar_t *mode); vtString vtChooseFolder(HWND hWnd =NULL); vtString2 vtChooseFolder2(HWND hWnd=NULL);
C++读取文件中的汉字,w
ifstream
,wstring的使用
C++使用w
ifstream
读取文件,wstring的使用,opencv的putText函数在图片上写汉字
(18)用std::w
ifstream
读取Unicode文本
在网上找了一个多小时,终于找到可以读取Unicode版本的代码,网上的资源真的太混乱了,还是google->stack overlow好啊: 记录代码,转载如下: https://stackoverflow.com/questions/26121782/read-unicode-file-with-special-characters-using-stdw
ifstream
代码如下: #in
w
ifstream
并不能理解UNICODE文本文件
今天在写一个小应用的时候,需要从一个UTF-16的文本文件中读入一个一个的宽字符,想当然的以为w
ifstream
天生就能识别 Unicode,代码如下(utf16.txt是一个用记事本编辑并保存为utf16格式的文本文件)001 w
ifstream
ifs("utf16.txt");002 for (;;) {003 wchar_t wc = ifs.get();00
[原创]C++, 利用std::w
ifstream
和std::getline方式对目标字符串进行拆分
[简介] 常用网名: 猪头三 出生日期: 1981.XX.XX 个人网站: https://www.x86asm.org QQ交流: 643439947 编程生涯: 2001年~至今[共18年] 职业生涯: 16年 开发语言: C/C++、80x86ASM、PHP、Perl、Objective-C、Object Pascal、C#、Python、JavaScript 开发工具: Visual St...
工具平台和程序库
24,854
社区成员
27,343
社区内容
发帖
与我相关
我的任务
工具平台和程序库
C/C++ 工具平台和程序库
复制链接
扫一扫
分享
社区描述
C/C++ 工具平台和程序库
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章