Thread: Help

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    112

    Help

    Code:
    #include<iostream>
    #include<io.h>
    using namespace std;
    
    struct  ffblk  
    { 
        long            ff_reserved;//whatever 
        long            ff_fsize;//the size of the file 
        unsigned long   ff_attrib;//the file's attributes 
        unsigned short  ff_ftime;//the file's timestamp 
        unsigned short  ff_fdate;//the file's datestamp 
        char            ff_name[256];//the file's name 
    };  
    
    
    
    
    int main()
    {
    	ffblk ffblk; 
    
    	int done;
    	done = _findfirst("*.TXT", &ffblk ,0);
     	cout<<done;
    
    	return 0;
    }
     function does not take 3 arguments

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    I would suggest being slightly more explicit next time.

    Are you referring to this API? _findfirst, _findfirst64, _findfirsti64, _wfindfirst, _wfindfirst64, _wfindfirsti64 (CRT) If so, note
    Quote Originally Posted by http://msdn.microsoft.com/en-us/library/zyzxfzac%28VS.71%29.aspx
    Parameters:

    filespec
    - Target file specification (may include wildcards).
    fileinfo
    - File information buffer
    i.e., the compiler isnt lying when it says the API does not take 3 arguments--it takes 2.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    What's this?
    Playing "guess the question, guess the OS and guess the compiler" time?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    112
    Code:
    #include<iostream>
    #include<io.h>
    using namespace std;
    
    
    
    int main()
    {
    	struct _finddata_t fileinfo;
    	const char *filespec;
    
    	int done;
    	done = _findfirst("*.TXT", &fileinfo ); 
    	
     	cout<<done;
    
    	return 0;
    }

    The folder where it searches the file contains two text files.
    The output says 1387040 what does it mean?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    It means you haven't read the manual.
    See links in post #2
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed