LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-05-2015, 08:28 AM   #16
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263

How about doing it all in C?

Code:
#include<stdio.h>
#include<stdlib.h>

int main()
{
  int min, sec;
  char cmd[120];

  printf ("How many minutes would you like to nap for?\n");
  scanf("%d", &min);
  sec = min * 60 ;
  snprintf (cmd, 120, "rtcwake -m mem -s %d", sec);
  system(cmd);

  return 0;
}
 
  


Reply

Tags
bash, c programming, math



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash - difference between executing program in for loop and typing each command? jlarsen Programming 14 11-10-2008 05:38 PM
bash operations with string alenD Linux - Software 6 10-17-2008 02:43 PM
math program that I can enter math functions ... Four General 5 04-19-2006 08:02 PM
Math operations with PHP linuxfond Linux - Newbie 1 04-20-2005 06:58 AM
file operations in BASH snorky Linux - Newbie 2 11-24-2003 07:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration