如何将char转换为char * [英] How to convert char to char*

查看:758
本文介绍了如何将char转换为char *的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要转换两个args,然后将它们作为一个变量作为应用程序参数传递给CreateProcess函数.

Hi, I need to convert two args and then pass them as one variable into CreateProcess function as application arguments.

推荐答案

类型为char的对象不能可以通过任何合理的方式转换"为char*:它们具有完全不同的含义:单个字符与指向可以表示访问字符数据数组的单个字符的字符的指针.我确定您需要其他东西.函数CreateProcess是Windows API中的函数,其用法在这里完整描述:
http://msdn.microsoft.com/zh-我们/library/windows/desktop/ms682425%28v=vs.85%29.aspx [
The object of type char cannot be "converted" to char* in any reasonable ways: they have completely different sense: an individual character vs a pointer to a character which can represent access to an individual character of an array of character data. I''m sure you need something different. The function CreateProcess is the one from Windows API and its usage is completely described here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx[^].

This is a native function, so the difference between C++ or C++/CLI is irrelevant here, it could be C++ or C.

It looks like you are deeply confused about the very basics in programming: pointers, will need to learn a lot from scratch. I''m not sure you are ready to use mixed mode programming (managed + CLI) — just yet, need to step back and learn much more elementary things first.

—SA


这篇关于如何将char转换为char *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆