else有语法错误c语言,If-else中C中的奇怪语法错误

我正在编写一个apache模块.在编程过程中,我正在打开一个文件,但编译时出错了.

32. static int wqb_handler(request_rec* req){

33. // Open and read our requested file

34. const char* p_file = req->filename;

35.

36. FILE* req_file;

37. if((req_file = fopen(p_file,"r"))==NULL){

38. return HTTP_NOT_FOUND;

39. }else{

40. fclose(req_file);

41. }

42. // Required variables

43. const char* content_type_a = "text/html";

44.

45. // Set Headers

46. ap_set_content_type(req,content_type_a);

47. if(req->header_only){

48. return OK;

49. }

50.

51.

52. return OK;

53. }

问题在于该函数,我正在检查这是问题,我认为问题是if-else语句,代码是用C语言编写的,而不是用C语言编写的.

这些是错误:

C:/wqb/wqb1_apache2.c(43) : error C2143: syntax error : missing ';' in front of 'const'

C:/wqb/wqb1_apache2.c(46) : error C2065: 'content_type_a' : undeclarated identifier

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值