The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
This might be a programming teaser! ljankok Shell Programming and Scripting 1 12-29-2008 07:54 AM
C Brain Teaser vrk1219 High Level Programming 34 08-03-2008 02:17 PM
Korn -- an extended shell iBot UNIX and Linux RSS News 0 05-05-2008 11:20 AM
Extended ascii avis High Level Programming 0 08-29-2004 10:44 AM
about extended memory rajashekaran High Level Programming 1 12-01-2001 01:20 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-08-2009
vrk1219 vrk1219 is offline
Registered User
  
 

Join Date: Feb 2005
Location: Bangalore
Posts: 9
Lightbulb Brain Teaser Extended

Hi Gurus,
To the Brain Teaser, if I add another condition, say the executable should not be altered, how the program should be altered? (no perl please, purely C). I forgot to mention this condition my staff had mentioned. ( forgot then and got now )

The program executed the first time should do some thing and if executed again, should do nothing. (not to encounter "file missing" error though )

Regards
RK Veluvali
  #2 (permalink)  
Old 09-08-2009
shamrock shamrock is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2007
Location: USA
Posts: 750
You want a self modifying executable which is not allowed due to the separation and protection of the text segment which is shared and readonly.
  #3 (permalink)  
Old 09-08-2009
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,952
For the first time, when the executable is run -
Code:
check if file /var/tmp/epoch_seconds is available
if available
  unlink and exit
  don't run
else
  create the above file and terminate
fi
with this, it will run only for the first time and not for the second time
  #4 (permalink)  
Old 09-09-2009
uunniixx uunniixx is offline
Registered User
  
 

Join Date: May 2008
Posts: 29
Does the program support DB interaction? If so reserve a flag for this application and flip it as per usage.
  #5 (permalink)  
Old 09-10-2009
Vi-Curious Vi-Curious is offline
Registered User
  
 

Join Date: Jul 2008
Location: Texas
Posts: 129
On first run, the program could modify its mtime (or some portion of mtime like microseconds) to some specific value and then on subsequent runs if it sees that mtime quit.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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




All times are GMT -4. The time now is 07:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0