PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : File Handling


BUGFIX
2004-01-12, 14:00:50
Hi!
kennt irgendjemand eine (vernünftige C/C++) Variante bei dateien >> 4 GigaByte die Größe auszugeben ?
Sämmtliche Stream-Klassen scheiden ab 4 Gig entweder mit angaben 0Bytes oder wie bei Borlands VCL mit negativen Größen aus.

Thx im Voraus

MfG

BUGFIX

Obligaron
2004-01-12, 14:56:43
struct _stati64 buf;
__int64 result;


/* Get data associated with "stat.c": */
int exits = this->FileExist();
if(exits != 0) return exits;
result = _stati64( this->m_FilePath, &buf );

/* Check if statistics are valid: */
if( result != 0 )
//perror( "Problem getting information" );
return -1;
else
{
return buf.st_size;
}

//methode nr2:
int fh;
if( (fh = _open( "C:\\fread.out", _O_RDWR | _O_CREAT, _S_IREAD
| _S_IWRITE )) != -1 )
{
return _filelengthi64( fh ) );
}
else return -1;

Gerade nochmal mit einer 5,irgendwas GB Datei getested.

MfG,
obligaron

BUGFIX
2004-01-13, 16:59:15
Danke erstmal;
zur Methode Nr2 hätt ich noch ne frage:
wo genau ist dir funktion _filelengthi64 definiert bzw welche header brauch ich dazu?

BUGFIX
2004-01-13, 17:11:44
_filelengthi64()
M$ VC++ only?

Obligaron
2004-01-14, 09:30:32
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__filelength.2c_._filelengthi64.asp

Requirements
Function Required header Compatibility
_filelength <io.h> Win 98, Win Me, Win NT, Win 2000, Win XP
_filelengthi64 <io.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

MfG