Go to Post I WANT MY POOF BALLS! - Cyber Punk 234 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-02-2005, 07:34
SpeakerSilenced SpeakerSilenced is offline
Programming/Electrical Team Member
#0219 (Team Impact)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Hackettstown, NJ
Posts: 28
SpeakerSilenced is an unknown quantity at this point
Send a message via AIM to SpeakerSilenced
Re: Running Once?

There is a simpler way of having something only run once...
Code:
int counter = 0;
if (counter == 0)
{
do whatever you want once;
counter++;
}
It will never be executed again unless you set counter = to 0... you can change the variable name too and name it whatever the function is supposed to do such as camera_settings, etc...
__________________
"I want to put a ding in the universe" - Steve Jobs
  #2   Spotlight this post!  
Unread 23-02-2005, 15:33
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Running Once?

Quote:
Originally Posted by SpeakerSilenced
There is a simpler way of having something only run once...
Code:
int counter = 0;
if (counter == 0)
{
do whatever you want once;
counter++;
}
It will never be executed again unless you set counter = to 0... you can change the variable name too and name it whatever the function is supposed to do such as camera_settings, etc...
That will be called every time unless counter is declared as a static int
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kitbot/cims/transmissions running too slow? Swampdude Technical Discussion 28 23-01-2005 11:17
Running OSX 10.3 on a Macintosh Centris Joe Matt Chit-Chat 4 27-10-2004 00:37
Dual sites on home server running apache? Mike AA IT / Communications 7 28-08-2004 02:02
A vampire running for office MissInformation Chit-Chat 2 30-08-2003 14:36
The WebCam is Up and running archiver 2001 0 23-06-2002 23:08


All times are GMT -5. The time now is 21:10.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi