[英]Preprocessor C program to replace include headers
I have homework assignment where I need to write a program to replace include commands (assuming there are no standard library includes) of C file with the actual.h' file (performing the preprocessor's job).我有家庭作业,我需要编写一个程序来用actual.h'文件替换C文件的包含命令(假设没有标准库包含)(执行预处理器的工作)。
I thought using regex matching, but since we are only allowed to use ansi-C's standard libraries regex is not allowed.我想使用正则表达式匹配,但由于我们只允许使用 ansi-C 的标准库,所以不允许使用正则表达式。
I am not sure what is the efficient way to do so?我不确定这样做的有效方法是什么?
edit: there is no need to check for #defines
or #ifdefs
.编辑:无需检查#defines
或#ifdefs
。
I suggest you follow this guide to create your program:我建议您按照本指南创建程序:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.