Click here to Skip to main content
15,914,416 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to create MainMenu Designer. Pin
Heath Stewart22-Feb-05 12:35
protectorHeath Stewart22-Feb-05 12:35 
GeneralIs it easy to migrate from VB.net to C# Pin
MyThread22-Feb-05 5:46
MyThread22-Feb-05 5:46 
GeneralRe: Is it easy to migrate from VB.net to C# Pin
Dave Kreskowiak22-Feb-05 6:15
mveDave Kreskowiak22-Feb-05 6:15 
GeneralRe: Is it easy to migrate from VB.net to C# Pin
MyThread22-Feb-05 6:44
MyThread22-Feb-05 6:44 
GeneralRe: Is it easy to migrate from VB.net to C# Pin
Rei Miyasaka22-Feb-05 16:24
Rei Miyasaka22-Feb-05 16:24 
GeneralRe: Is it easy to migrate from VB.net to C# Pin
SimonS22-Feb-05 8:09
SimonS22-Feb-05 8:09 
GeneralRe: Is it easy to migrate from VB.net to C# Pin
Dave Doknjas22-Feb-05 14:17
Dave Doknjas22-Feb-05 14:17 
GeneralQueryPerformance Pin
wallacej22-Feb-05 5:23
wallacej22-Feb-05 5:23 
Hello

Can anybody explain to me why the following four bold lines of code yield different results to their counterparts on the line below? By my reckoning the results should be the same with the only difference being one set are printed to the console window and the other to a text file. The purple lines are definitely creating correct results because they are a product of help code for Microsoft Visual Studio .NET and the results look good. The red lines of code (my code) are definitely producing incorrect results and all four of the outputs are often identical. Am I doing some memory management incorrectly???
<br />
#include "stdafx.h"<br />
<br />
#using <mscorlib.dll><br />
#include <tchar.h><br />
#include <windows.h><br />
#include <stdio.h><br />
<br />
using namespace System;<br />
<br />
// This is the entry point for this application<br />
int _tmain(void)<br />
{<br />
    _int64 ctr1 = 0, ctr2 = 0, freq = 0;<br />
	int acc = 0, i = 0;<br />
	FILE *storage;<br />
<br />
	//Start timing the code<br />
	if(QueryPerformanceCounter((LARGE_INTEGER *)&ctr1) != 0)<br />
	{<br />
		storage = fopen("C:\\TestTimer.txt", "a"); //Open a file for data output<br />
		//Code segment is being timed<br />
		for(i=0; i<100; i++) acc++;<br />
		//Finish timing the code<br />
		QueryPerformanceCounter((LARGE_INTEGER *)&ctr2);<br />
<br />
		fprintf(storage, "Start Value %i\n", ctr1.ToString());<br />
		Console::WriteLine("Start Value: {0}",ctr1.ToString());<br />
<br />
		fprintf(storage, "End Value %i\n", ctr2.ToString());<br />
		Console::WriteLine("End Value: {0}",ctr2.ToString());<br />
<br />
		QueryPerformanceFrequency((LARGE_INTEGER *)&freq);<br />
<br />
		fprintf(storage, "Frequency %i\n", freq.ToString());<br />
		Console::WriteLine(S"QueryPerformanceCounter minimum resolution: 1/{0} seconds.",freq.ToString());<br />
<br />
		fprintf(storage, "Time %i\n", ((ctr2-ctr1) * 1.0 / freq).ToString());		<br />
		Console::WriteLine("100 Increment time: {0} seconds.",((ctr2-ctr1) * 1.0 / freq).ToString());<br />
<br />
		fclose(storage);<br />
	} 	<br />
	return 0;<br />
}

GeneralRe: QueryPerformance Pin
Judah Gabriel Himango22-Feb-05 5:44
sponsorJudah Gabriel Himango22-Feb-05 5:44 
GeneralRe: QueryPerformance Pin
Rei Miyasaka22-Feb-05 16:56
Rei Miyasaka22-Feb-05 16:56 
QuestionHow To Create A Shortcut (.lnk) in Code Pin
exhaulted22-Feb-05 4:36
exhaulted22-Feb-05 4:36 
AnswerRe: How To Create A Shortcut (.lnk) in Code Pin
spif200122-Feb-05 5:28
spif200122-Feb-05 5:28 
GeneralRe: How To Create A Shortcut (.lnk) in Code Pin
exhaulted23-Feb-05 20:58
exhaulted23-Feb-05 20:58 
GeneralAutoComplete in .net 2.0 Pin
djkno322-Feb-05 4:18
djkno322-Feb-05 4:18 
GeneralRe: AutoComplete in .net 2.0 Pin
djkno320-Apr-05 2:18
djkno320-Apr-05 2:18 
Generalblackberry Pin
2new22-Feb-05 3:56
2new22-Feb-05 3:56 
GeneralRe: blackberry Pin
Heath Stewart22-Feb-05 12:05
protectorHeath Stewart22-Feb-05 12:05 
GeneralRe: blackberry Pin
2new24-Feb-05 9:00
2new24-Feb-05 9:00 
QuestionHow to make TreeView like navigation bar Pin
lee meng22-Feb-05 2:58
lee meng22-Feb-05 2:58 
Generalformatting number Pin
dhol22-Feb-05 1:56
dhol22-Feb-05 1:56 
GeneralRe: formatting number Pin
leppie22-Feb-05 5:38
leppie22-Feb-05 5:38 
GeneralRe: formatting number Pin
dhol22-Feb-05 16:38
dhol22-Feb-05 16:38 
GeneralGetting the path of an open Word document Pin
Paladin5522-Feb-05 1:41
Paladin5522-Feb-05 1:41 
GeneralRe: Getting the path of an open Word document Pin
Heath Stewart22-Feb-05 12:30
protectorHeath Stewart22-Feb-05 12:30 
GeneralWeb method's parameter Pin
Ed Lee22-Feb-05 1:05
Ed Lee22-Feb-05 1: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.