Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-06-2006, 05:06 AM   #1 (permalink)
jaro
Registered User
 
jaro's Avatar
 
Join Date: Feb 2006
Posts: 9
jaro is on a distinguished road
Need some clarification....

Hi,

I have these ff. code:
Code:
/*test/dummy progam*/

#include <time.h>
//var declaration
clock_t start, finish;
double  duration;
double  limit = 5.00; // roughly equal to 5 seconds
int x;

int main(){
    //
    //
    //
    start = clock();
    x=1;

        while(1){

            finish = clock();
            duration = (finish - start) / CLOCKS_PER_SEC;
            if(limit < duration){
                 /* do stuff....*/      
                 printf("round %d",x++); // for example
                start = clock();
                duration =0.00;
            }
        }
return 0;
}
I know that this is not resourece friendly type of code. The code above is a test/dummy program ,the program while running will execute the printf() in every 5 second.

The test/dummy program works fine but when I try to insert this logic to the project that I'm currently working on , it does not work.

The project that I'm currently working on is converted/or run as a Windows service.It was previously a Win32 console application before it is converted to run as a windows service.

I've written the test/dummy program as a Win32 console application. Which work out just fine (nevermind the slowing of the pc). The funny thing is that when I try to convert the test/dummy program to run as a Windows service, it does not works as it is supposed to be. (I've change the printf("round %d",x++); to a writeToFile type of function).

Can anyone tell me why this is happening?
What does converting your program to run a windows service does to your program?

BTW: I'm Using MVC6 and my os is Win2K.

any kind of help will be appreciated.

additiona info:This is the solution that I've though of regarding my previous thread Timed function in C

regards,
jaro
jaro is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Black Jack woes ShadowSoft Standard C, C++ 4 02-27-2003 12:22 PM


All times are GMT -8. The time now is 06:39 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting