Click here to Skip to main content
15,909,466 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: File size limit Pin
Andrew Admire23-May-05 10:04
Andrew Admire23-May-05 10:04 
GeneralRe: File size limit Pin
David Crow23-May-05 10:15
David Crow23-May-05 10:15 
GeneralRe: File size limit Pin
Andrew Admire23-May-05 10:16
Andrew Admire23-May-05 10:16 
GeneralRe: File size limit Pin
David Crow23-May-05 10:37
David Crow23-May-05 10:37 
GeneralRe: File size limit Pin
Rick York23-May-05 10:28
mveRick York23-May-05 10:28 
GeneralRe: File size limit Pin
David Crow23-May-05 10:41
David Crow23-May-05 10:41 
GeneralRe: File size limit Pin
Andrew Admire23-May-05 10:46
Andrew Admire23-May-05 10:46 
GeneralRe: File size limit Pin
Rick York23-May-05 12:22
mveRick York23-May-05 12:22 
Here's my testing program :

int main( int argc, char* argv[] )
{
	FILE *fp = fopen( "C:\\Temp\\BigFile.txt", "wt" );
	if( ! fp )
	{
		fprintf( stderr, "Unable to open temporary file\n" );
		return -1;
	}

	int megcount = 0;
	if( argc > 1 )
		megcount = atoi( argv[1] );
	if( megcount < 100 )
		megcount = 100; 

	const __int64 onemeg = 1000000;
	__int64	max = megcount * onemeg;

	fprintf( stdout, "Beginning file writing of %d MB\n", megcount );

	const int writeincr = 20000000;
	int wcount = 0;

	CElapsed et;
	double start = et.Elapsed( 0.0 );

	__int64 total = 0;
	__int64 lines = 0;

	const char *format = 
"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234 line %8I64d\n";
	while( total < max )
	{
		int count = fprintf( fp, format, lines );
		total += (__int64)count;
		wcount += count;
		if( wcount >= writeincr )
		{
			wcount = 0;
			int meg = (int)( total / onemeg );
			double amount = et.Elapsed( start );
			fprintf( stdout, "%4d megabytes have been written : %.1f seconds elapsed\r",
				meg, amount );
		}
		++lines;
	}

	double elapsed = et.Elapsed( start );

	fclose( fp );
	fprintf( stdout, "\n\noutput file has been closed - %I64d lines were written in %.1f seconds\n",
			lines, elapsed );
	return 0;
}


The CElapsed class is one I wrote and contributed to codeguru years ago. It's use can be removed from the code if you want. It's only used in the diagnostic output.

This is just a hacked-together testing program that took about five minutes to write. It's not exactly an example of excellent code.
GeneralRe: File size limit Pin
24-May-05 3:54
suss24-May-05 3:54 
GeneralRe: File size limit Pin
Rick York23-May-05 12:29
mveRick York23-May-05 12:29 
QuestionHow to display a tooltip for ComboboxEx Pin
qin138823-May-05 7:26
qin138823-May-05 7:26 
AnswerRe: How to display a tooltip for ComboboxEx Pin
David Crow23-May-05 7:34
David Crow23-May-05 7:34 
GeneralRe: How to display a tooltip for ComboboxEx Pin
qin138823-May-05 9:32
qin138823-May-05 9:32 
GeneralRe: How to display a tooltip for ComboboxEx Pin
David Crow23-May-05 9:59
David Crow23-May-05 9:59 
GeneralReading CArchive in Serialize Pin
vasanth100423-May-05 7:14
vasanth100423-May-05 7:14 
GeneralRe: Reading CArchive in Serialize Pin
David Crow23-May-05 7:31
David Crow23-May-05 7:31 
GeneralRe: Reading CArchive in Serialize Pin
vasanth100423-May-05 7:36
vasanth100423-May-05 7:36 
GeneralRe: Reading CArchive in Serialize Pin
David Crow23-May-05 7:45
David Crow23-May-05 7:45 
GeneralRe: Reading CArchive in Serialize Pin
vasanth100423-May-05 7:48
vasanth100423-May-05 7:48 
GeneralRe: Reading CArchive in Serialize Pin
David Crow23-May-05 7:50
David Crow23-May-05 7:50 
GeneralRe: Reading CArchive in Serialize Pin
vasanth100423-May-05 8:02
vasanth100423-May-05 8:02 
GeneralRe: Reading CArchive in Serialize Pin
David Crow23-May-05 8:56
David Crow23-May-05 8:56 
GeneralOpenGL flickers despite double buffering Pin
User 58261923-May-05 6:58
User 58261923-May-05 6:58 
GeneralRe: OpenGL flickers despite double buffering Pin
LunaticFringe23-May-05 7:35
LunaticFringe23-May-05 7:35 
GeneralRe: OpenGL flickers despite double buffering Pin
cmk24-May-05 5:05
cmk24-May-05 5:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.