lcc-win32

How to check if a file has content or not using C?

北城以北 提交于 2020-04-08 10:40:48
问题 I have a source file file1 and a destination file file2 , here I have to move content from file1 to file2 . So I have to do some validation first. I must check source file is existing or not? I can check using this: fp = fopen( argv[1],"r" ); if ( fp == NULL ) { printf( "Could not open source file\n" ); exit(1); } Then I have to check if the source file has any content or not? If it is empty, I have to throw some error message. This is what I've tried until the moment. 回答1: C version: if

LCC: Forward Declaration of Typedef'd Enum Failing?

坚强是说给别人听的谎言 提交于 2019-12-10 16:32:11
问题 The following code snippet compiles just fine on Mac OS X with gcc, but fails to compile on Windows with lcc-win32: typedef enum Foo Foo; // Other code here enum Foo { Bar = 1 }; And gives this error: unknown enumeration 'Foo' In my particular case, this was not a problem. I simply combined the statements into: typedef enum Foo { Bar = 1 } Foo; But I'm wondering if LCC is being either "more strict" (adhering to some standard) or "more dumb" (the compiler is too dumb to handle this situation).