为什么它不起作用 [英] why it does not work

查看:102
本文介绍了为什么它不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很奇怪!我写了这样的片段:


char messageBody [MAX_DTMF_MESSAGE_SIZE] ="" ;;

printf(" message body:%s \ n", messageBody);

strcat(messageBody," Signal =");

printf(" message body:%s \ n",messageBody);

strcat(messageBody,CCDTMFMap [digit]);

printf(" message body:%s \ n",messageBody);

strcat (messageBody,CRLF);

printf(" message body:%s \ n",messageBody);

strcat(messageBody," Duration = 160") ;

printf("邮件正文:%s \ n",messageBody);

strcat(messageBody,CRLF);

printf (消息正文:%s \ n,messageBody;


并且它有效,但如果我撤回所有printf,它就无法正常工作,可以

有谁告诉我为什么?非常感谢。

It''s strange! I wrote such fragment:

char messageBody[MAX_DTMF_MESSAGE_SIZE] = "";
printf("message body: %s\n", messageBody);
strcat(messageBody, "Signal= ");
printf("message body: %s\n", messageBody);
strcat(messageBody, CCDTMFMap[digit]);
printf("message body: %s\n", messageBody);
strcat(messageBody, CRLF);
printf("message body: %s\n", messageBody);
strcat(messageBody, "Duration= 160");
printf("message body: %s\n", messageBody);
strcat(messageBody, CRLF);
printf("message body: %s\n", messageBody);

and it works, but if I withdraw all the printf, it fails to work, can
anybody tell me why? Thanks very much.

推荐答案

br*******@gmail.com 写道:
这很奇怪!我写了这样的片段:

char messageBody [MAX_DTMF_MESSAGE_SIZE] ="" ;;
printf(" message body:%s \ n",messageBody);
strcat (messageBody," Signal =");
printf(" message body:%s \ n",messageBody);
strcat(messageBody,CCDTMFMap [digit]);
printf(" message body:%s \ n",messageBody);
strcat(messageBody,CRLF);
printf(" message body:%s \ n",messageBody);
strcat(messageBody," Duration = 160");
printf(" message body:%s \ n",messageBody);
strcat(messageBody,CRLF);
printf(邮件正文:%s \ n,messageBody)

并且它有效,但如果我撤回所有printf,它就无法正常工作,可以告诉任何人我为什么?非常感谢。
It''s strange! I wrote such fragment:

char messageBody[MAX_DTMF_MESSAGE_SIZE] = "";
printf("message body: %s\n", messageBody);
strcat(messageBody, "Signal= ");
printf("message body: %s\n", messageBody);
strcat(messageBody, CCDTMFMap[digit]);
printf("message body: %s\n", messageBody);
strcat(messageBody, CRLF);
printf("message body: %s\n", messageBody);
strcat(messageBody, "Duration= 160");
printf("message body: %s\n", messageBody);
strcat(messageBody, CRLF);
printf("message body: %s\n", messageBody);

and it works, but if I withdraw all the printf, it fails to work, can
anybody tell me why? Thanks very much.



您期望它做什么,没有做到?


What did you expect it to do, that is not done?


我有填写SIP的消息正文,当我在没有printf的情况下填写

时,它只是报告错误。但我想知道为什么printf

这里有差异。

I have to fill the message body for SIP, and when I filled it in
without printf, it simply report errors. But I was wondering why printf
here makes the differece.


br ******* @ gmail.com 于06/09/05写道:
br*******@gmail.com wrote on 06/09/05 :
这很奇怪!我写了这样的片段:
< ...>它的工作原理
It''s strange! I wrote such fragment: <...> and it works




编号根本没编译。


main.c:4:错误:` MAX_DTMF_MESSAGE_SIZE''未声明此处(不在

函数中)

main.c:5:错误:字符串常量之前的语法错误

main。 c:5:警告:在'printf'的声明中默认为'int''

main.c:5:警告:内置函数''printf''的冲突类型/>
main.c:5:警告:数据定义没有类型或存储类


main.c:6:错误:字符串常量之前的语法错误

main.c:6:警告:在'strcat'的声明中默认为'int''

main.c:6:警告:内置函数的冲突类型''strcat''

main.c:6:警告:数据定义没有类型或存储类

main.c:7:错误:字符串常量之前的语法错误

main.c:7:警告:在'printf'的声明中输入默认为'int''

main .c:7:警告:数据定义没有类型或存储类

main.c:8:错误:''''令牌之前的语法错误

main。 c:8:警告:在'strcat'的声明中默认为'int''

main.c:8:警告:数据定义没有类型或存储类

main.c:9:错误:字符串常量之前的语法错误

main.c:9:警告:在'printf'的声明中默认为'int''类型

main.c:9:警告:数据定义没有类型或存储类

main.c:10:警告:在'strcat''的声明中,类型默认为`int'' br />
main.c:10:警告:函数中的参数名称(没有类型)

声明

main.c:10:警告:数据定义没有类型或存储类

main.c:11:错误:字符串常量之前的语法错误

main.c:11:警告:类型默认为'printf''声明中的`int''

main.c:11:警告:数据定义有没有类型或存储类

main.c:12:错误:字符串常量之前的语法错误

main.c:12:警告:类型默认为` int''在'strcat'的声明中'

main.c:12:警告:数据定义没有类型或存储类

main.c:13:错误:字符串常量之前的语法错误


main.c:13:警告:在'printf'的声明中输入默认为'int''

main.c :13:警告:数据定义没有类型或存储类

main.c:14:警告:在'strcat'的声明中默认为'int''类型

main.c:14:警告:函数中的参数名称(没有类型)

声明

main.c:14:警告:数据定义没有类型或存储类

main.c:15:错误:字符串常量之前的语法错误

main.c:15:警告:在声明中类型默认为int 'printf''

main.c:15:警告:数据定义没有类型或storag e class

main.c:4:错误:'messageBody'的存储大小是不知道的


请提供更深层次的编译源分析。我们不是

通灵。


-

Emmanuel

C-FAQ:< a rel =nofollowhref =http://www.eskimo.com/~scs/C-faq/faq.htmltarget =_ blank> http://www.eskimo.com/~scs/C -faq / faq.html

C库: http://www.dinkumware.com/refxc.html


..sig正在修复



No. Doesn''t compile at all.

main.c:4: error: `MAX_DTMF_MESSAGE_SIZE'' undeclared here (not in a
function)
main.c:5: error: syntax error before string constant
main.c:5: warning: type defaults to `int'' in declaration of `printf''
main.c:5: warning: conflicting types for built-in function ''printf''
main.c:5: warning: data definition has no type or storage class

main.c:6: error: syntax error before string constant
main.c:6: warning: type defaults to `int'' in declaration of `strcat''
main.c:6: warning: conflicting types for built-in function ''strcat''
main.c:6: warning: data definition has no type or storage class
main.c:7: error: syntax error before string constant
main.c:7: warning: type defaults to `int'' in declaration of `printf''
main.c:7: warning: data definition has no type or storage class
main.c:8: error: syntax error before ''['' token
main.c:8: warning: type defaults to `int'' in declaration of `strcat''
main.c:8: warning: data definition has no type or storage class
main.c:9: error: syntax error before string constant
main.c:9: warning: type defaults to `int'' in declaration of `printf''
main.c:9: warning: data definition has no type or storage class
main.c:10: warning: type defaults to `int'' in declaration of `strcat''
main.c:10: warning: parameter names (without types) in function
declaration
main.c:10: warning: data definition has no type or storage class
main.c:11: error: syntax error before string constant

main.c:11: warning: type defaults to `int'' in declaration of `printf''
main.c:11: warning: data definition has no type or storage class
main.c:12: error: syntax error before string constant

main.c:12: warning: type defaults to `int'' in declaration of `strcat''
main.c:12: warning: data definition has no type or storage class
main.c:13: error: syntax error before string constant

main.c:13: warning: type defaults to `int'' in declaration of `printf''
main.c:13: warning: data definition has no type or storage class
main.c:14: warning: type defaults to `int'' in declaration of `strcat''

main.c:14: warning: parameter names (without types) in function
declaration
main.c:14: warning: data definition has no type or storage class
main.c:15: error: syntax error before string constant
main.c:15: warning: type defaults to `int'' in declaration of `printf''
main.c:15: warning: data definition has no type or storage class
main.c:4: error: storage size of `messageBody'' isn''t known

Please provide a compiling source for a deeper analysis. We are not
psychic.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

..sig under repair


这篇关于为什么它不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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