Check The File Existance With Oneline Code

Code Id 5
Date Updated 3/7/2010
Title Check the file existance with oneline code.  
Description
Write a program that figures out whether there is a file named data.txt.If data.txt exists,the program must exit 0 (for example, return 0 from main);
otherwise it must exit 100.You may assume that nothing unusual will happen;for example, you may assume that there are no disk errors. 
                                  
Codes Snippet
#include 

int main(void)
{
  exit(fopen("data.txt","r") ? 0 : 100);
}

Comments are closed.