Return pointer from function C

In my C program this function is going to handle all the work of opening a specific file and then return the file pointer, so main or other functions can read the content by using fp, but so far i haven't been able to get this to work. I'm just learning the language, so it is possible that i am doing something very wrong. int open_text_file(char text_file_name[]) { FILE *fp; if((fp = fopen(text_file_name, "r")) != 0) { return fp; } else { printf("Cannot open file \"%s\"\n", text_file_name); } }

以上就是Return pointer from function C的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准