社区
C#
帖子详情
怎么把vc++里面的cstring转换为C#中的string 或int float 急急急 一定给分
luluyy
2008-07-12 04:05:44
跟标题一样 在线等
...全文
530
14
打赏
收藏
怎么把vc++里面的cstring转换为C#中的string 或int float 急急急 一定给分
跟标题一样 在线等
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
14 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
jack99122
2009-07-13
打赏
举报
回复
CString s("JiangSu");
String^ str1=gcnew String(s);
这样就可以了
hoocode2008
2008-07-13
打赏
举报
回复
http://www.skinfeature.com
珍惜生命远离CPP
2008-07-13
打赏
举报
回复
[Quote=引用 8 楼 luluyy 的回复:]
。。。。为的就是把程序简单话 找那东西太麻烦 还不稳定~~ 接着等 就不信中国没能人
[/Quote]
搞编译器的ms都没能搞出来
luluyy
2008-07-12
打赏
举报
回复
==啊~ 烦死了 不懂C++
gomoku
2008-07-12
打赏
举报
回复
[Quote=引用 8 楼 luluyy 的回复:]
。。。。为的就是把程序简单话 找那东西太麻烦 还不稳定~~ 接着等 就不信中国没能人
[/Quote]
中国能人是很多。但不是人有多大胆,地有多大产。
做程序要讲究科学的方法。不能做的事情,等上十年公鸡也不会下蛋。
gomoku
2008-07-12
打赏
举报
回复
看不到导出的函数,你要贴
导出到C#
的函数。
如果你的dll是导出整个类的MFC扩展dll,那么C#不能直接用(只用MFC程序才能用扩展dll)。
luluyy
2008-07-12
打赏
举报
回复
。。。。为的就是把程序简单话 找那东西太麻烦 还不稳定~~ 接着等 就不信中国没能人
yagebu1983
2008-07-12
打赏
举报
回复
找个转换器试试!!!
luluyy
2008-07-12
打赏
举报
回复
// VCforALLDlg.h : header file
//
#if !defined(AFX_VCFORALLDLG_H__954EDFBA_4DE7_4080_AC06_C864638A3727__INCLUDED_)
#define AFX_VCFORALLDLG_H__954EDFBA_4DE7_4080_AC06_C864638A3727__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CVCforALLDlg dialog
class CVCforALLDlg : public CDialog
{
// Construction
public:
bool m_bLoaded;
CVCforALLDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CVCforALLDlg)
enum { IDD = IDD_VCFORALL_DIALOG };
CString m_strAddress;
CString m_strBirthday;
CString m_strName;
CString m_strNation;
CString m_strNumber;
CString m_strResult;
CString m_strSex;
CString m_strSignDate;
CString m_strValidate;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CVCforALLDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CVCforALLDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnClose();
afx_msg void OnButtonRecgID();
afx_msg void OnButtonDDScanRecog();
afx_msg void OnButtonNIDScanRecog();
afx_msg void OnButtonOldIdScanRecog();
afx_msg void OnButtonPP();
afx_msg void OnButtonID2();
afx_msg void OnBtnCalibrate();
afx_msg void OnButtonPPR();
afx_msg void OnBtnScanOther();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedOk();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VCFORALLDLG_H__954EDFBA_4DE7_4080_AC06_C864638A3727__INCLUDED_)
gomoku
2008-07-12
打赏
举报
回复
你贴
一小段
使用CString的函数,让大家试试看改动的方法。
luluyy
2008-07-12
打赏
举报
回复
愁死~ 哪个兄台对C++了解深的话~我可以提供源代码~ 帮忙改一个~~ 分加倍~~~ 继续等!!!416700390@qq.com
luluyy
2008-07-12
打赏
举报
回复
现在呢 我是把C++的程序搬到C#上来~ 就是C++中的CSTRING 类型无法在c#中得到应用 也就是说转换不过来·所以程序无法进行~ 说的详细一点吧 提供个解决方案~· 最好有一段例子~~ 谢谢了·解决吧就加分!!
珍惜生命远离CPP
2008-07-12
打赏
举报
回复
这两个东西差别太大,
要想传递字符串的话只能使用原始类型
gomoku
2008-07-12
打赏
举报
回复
如果你能有vc++源文件的话,把CString改成其他简单类型,比如LPWSTR等,或C#能理解的BSTR。
1、VC编译器知道CString的结构和类信息,并在CString超出作用域的地方,插入CString的析构函数。
2、但C#并不知道CString的具体实现,不知道如何把CString转换为C# string,也不会析构CString。
3、即使通过一些偏移量硬从CString得到内部的string,也很容易造成内存的泄漏。
4、其实就是都用C++,不用版本的CString也会造成麻烦。
【V
C++
】C
String
与std::
string
互转
C
String
cStr(_T("hello")); std::
string
str; C
String
转std::
string
str=CW2A(cStr.Get
String
()); std::
string
-转C
String
cStr=str.c_str();
V
C++
C
String
与
int
类型
转换
摘自:... C
String
_temp = "100";
int
_
int
; _
int
= atoi(_temp); =================================== =================================== CSt...
V
C++
中
C
String
与
int
互相
转换
环境 VS2010, MFC。 以前读书的时候 貌似学过,不过快一年没碰
C++
...C
String
-->
int
C
String
str = _T("1000");
int
a= _ttoi(str);
int
--> C
String
int
a = 1000; C
String
str ; str.Format(_T("%d")
V
C++
中
的C
String
、char、
int
类型
转换
1、如何将C
String
类型的变量赋给char*类型的变量 方法一:GetBuffer函数 使用C
String
::GetBuffer函数。 char *p; C
String
str="hello"; p=str.GetBuffer(str.GetLength()); str.ReleaseBuffer(); 将C
String
转换
成...
V
C++
6.0 MFC
中
C
String
与
int
、double、
float
等数据互相转化
在MFC程序
中
,可以使用Format方法方便的实现
int
、
float
和double等数字类型
转换
为C
String
字符串。以下是C
String
的Format支持的格式说明:
C++
表达方式 数据类型 %c 单个字符 %d 十进制整数(
int
) ...
C#
110,502
社区成员
642,567
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章