strncat复制垃圾值.... [英] strncat copies junk values ....

查看:66
本文介绍了strncat复制垃圾值....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌无法收回邮件..因此我无法写下

后续内容..我猜这个会显示为新帖子...

无论如何,谢谢所有人的回复..


你可以再问一个问题..


如你所说,不需要演员,在下面的陈述中

...

Google was not able to retreive the message .. so I couldnt write a
followup .. I guess this one will be displayed as a new post ...

anyways, thank you all people for all your replies ..

can you please clear one more question ..

As you have said, the cast is not needed, in the following statement
...

final =(char *)malloc(count * sizeof( char));
if(!(final =(char *)malloc(count + 1)))


但是当我执行没有强制转换的程序时,如下所示,

final = malloc(count * sizeof(char));
if(!(final = malloc(count + 1)))
final = (char *) malloc (count * sizeof(char));
if (!(final = (char *)malloc(count + 1)))
But when i execute the program without the cast, as below,
final = malloc (count * sizeof(char));
if (!(final = malloc(count + 1)))



i得到错误

"无效转换从空* *到char *"


对此有任何解释..


再次感谢..



i get the error
"Invalid conversion from void* to char*"

Any explanation for this ..

thanks again ..

推荐答案




Vaddina Prakash Rao写道:


Vaddina Prakash Rao wrote:
后续内容..我猜这个将会显示为一个新帖子......

无论如何,谢谢各位回复你们所有人......

请你再澄清一个问题..

正如你所说,不需要演员,在下面的陈述中
..

Google was not able to retreive the message .. so I couldnt write a
followup .. I guess this one will be displayed as a new post ...

anyways, thank you all people for all your replies ..

can you please clear one more question ..

As you have said, the cast is not needed, in the following statement
..

final =(char *)malloc(count * sizeof(char));
if(!(final =(char *) )malloc(count + 1)))
final = (char *) malloc (count * sizeof(char));
if (!(final = (char *)malloc(count + 1)))



但是当我执行没有演员的程序时,如下所示,


But when i execute the program without the cast, as below,

final = malloc(count * sizeof(char));
if(!(final = malloc(count + 1)))
final = malloc (count * sizeof(char));
if (!(final = malloc(count + 1)))



i得到错误
;无效转换从void *到char *"

对此有任何解释..

再次感谢..


i get the error
"Invalid conversion from void* to char*"

Any explanation for this ..

thanks again ..




您没有使用C编译器来编译C.

您正在使用C ++编译器来编译C.是一个坏主意

甚至是明显的 C和C ++的公共子集不是

真正的公共子集。


使用C编译器。

干杯
Michael

-

电子邮件:我的是gmx dot de地址。



You are not using a C compiler to compile C.
You are using a C++ compiler to compile C. This is a Bad Idea
as even the "obvious" common subset of C and C++ is not the
real common subset.

Use a C compiler.
Cheers
Michael
--
E-Mail: Mine is a gmx dot de address.


pr********@gmail.com (Vaddina Prakash Rao)写道:
pr********@gmail.com (Vaddina Prakash Rao) writes:
Google无法收回邮件..因此我无法写下
后续内容..我猜这个会显示为新帖子...
<无论如何,谢谢所有人的回复..

请你再问一个问题..

如你所说,不需要演员表,在以下声明中
..
Google was not able to retreive the message .. so I couldnt write a
followup .. I guess this one will be displayed as a new post ...

anyways, thank you all people for all your replies ..

can you please clear one more question ..

As you have said, the cast is not needed, in the following statement
..
final =(char *)malloc(count * sizeof(char));
if(!(final =( char *)malloc(count + 1)))
final = (char *) malloc (count * sizeof(char));
if (!(final = (char *)malloc(count + 1)))



但是当我执行没有强制转换的程序时,如下所示,



But when i execute the program without the cast, as below,

final = malloc(cou nt * sizeof(char));
if(!(final = malloc(count + 1)))
final = malloc (count * sizeof(char));
if (!(final = malloc(count + 1)))



我收到错误
无效的转换从void *到char *"



i get the error
"Invalid conversion from void* to char*"




您可能正在使用C ++编译器(C ++不允许隐式

转换从void *到char *)..使用C编译器。


您的C和C ++编译器可能是同一个程序。通常,源文件名上的

后缀决定了哪一个被调用(例如,对于C,。C,。c,。b,。c,。c ;或C ++的.cpp。


-

Keith Thompson(The_Other_Keith) ks *** @ mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。



You''re probably using a C++ compiler (C++ doesn''t allow implicit
conversions from void* to char*).. Use a C compiler.

Your C and C++ compilers may be the same program. Typically the
suffix on the source file name determines which one is invoked (e.g.,
".c" for C, ".C", ".cc", or ".cpp" for C++).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


Vaddina Prakash Rao写道:
Vaddina Prakash Rao wrote:
正如你所说,不需要演员,在以下语句中
As you have said, the cast is not needed, in the following statement
final =(char *)malloc(count * sizeof(char));
if(!(final = (char *)malloc(count + 1)))
但是当我执行没有强制转换的程序时,如下所示,
final = malloc(count * sizeof(char));
if (!(final = malloc(count + 1)))
final = (char *) malloc (count * sizeof(char));
if (!(final = (char *)malloc(count + 1))) But when i execute the program without the cast, as below, final = malloc (count * sizeof(char));
if (!(final = malloc(count + 1)))



i得到错误
无效转换从void *到char *"

对此的任何解释..


i get the error
"Invalid conversion from void* to char*"

Any explanation for this ..




您正在使用C ++编译器。如果您使用的产品声称能够编译C,一种不同的语言,那么它有一个方法

将其作为C编译器调用。有时这很简单,因为使用.c

作为文件名的尾部。无论需要什么,都可以使用它。 C ++不是C.



You are using a C++ compiler. If the product you are using claims to be
able to compile C, a different language, then it has a method of
invoking it as a C compiler. Sometimes that is a simple as using ".c"
as the tail of the file name. Whatever it takes, use it. C++ is not C.


这篇关于strncat复制垃圾值....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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