[英]read split input by space enter by user in textfield
I need to create a program that is able to detect syntax error in C language programming. 我需要创建一个程序,该程序能够检测C语言编程中的语法错误。 Let's say the grammar should be 假设语法应该是
printf("statement");
How could I create an interface that is able to detect if there's any error in the coding? 如何创建一个能够检测编码中是否有错误的接口? The output should be "Syntax error!Please try again" or "Well done!No syntax error" 输出应为“语法错误!请重试”或“做得好!无语法错误”
My teacher advice me to use stringtokenizer . 我的老师建议我使用stringtokenizer 。 Can anyone help me with this? 谁能帮我这个? I dont mind if the user need to space for each input such as: 我不介意用户是否需要为每个输入留出空间,例如:
**printf** (space) **("** (space) **statement** (space) **")** (space) **;**
Yes. 是。 the tokenizer function [in c
] you are looking for is strtok_r()
. 您要查找的tokenizer函数[在c
]是strtok_r()
。 Please check the details regarding the usage of this function in the man page here . 请在此处的手册页中查看有关此功能用法的详细信息。
However, this is going to be a tricky job. 但是,这将是一项棘手的工作。 Best of luck with your efforts. 祝您好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.