• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 592
  • Last Modified:

CFileStatus in Release mode.

I try to get the file status in MFC and found that of the two versons, only
file.GetStatus(fstatus) works (i.e. with an opened file) in Release mode
while the static function:
CFile::GetStatus(filename,fstatus) does not work in Release mode.(although it works in Debug mode)
Why is it so and what is the best and easiest way to check file status without opening the file. Like checking the modified time.
0
hshliang
Asked:
hshliang
1 Solution
 
hshliangAuthor Commented:
Edited text of question.
0
 
chensuCommented:
Both should work fine. Post your code please.
0
 
inprasCommented:
To check a status of file (copied from help)
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>

void main( void )
{
   struct _stat buf;
   int result;
   char buffer[] = "A line to output";

   /* Get data associated with "stat.c": */
   result = _stat( "stat.c", &buf );

   /* Check if statistics are valid: */
   if( result != 0 )
      perror( "Problem getting information" );
   else
   {
      /* Output some of the statistics: */
      printf( "File size     : %ld\n", buf.st_size );
      printf( "Drive         : %c:\n", buf.st_dev + 'A' );
      printf( "Time modified : %s", ctime( &buf.st_atime ) );
   }
}
Regards
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now