The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
UNIX in the MacIntosh (for sed people) Laurel Maury Shell Programming and Scripting 3 09-27-2006 02:32 PM
IP Address History for Macintosh olifer UNIX for Dummies Questions & Answers 0 05-26-2006 01:55 PM
Macintosh user needs help with pop3d fundidor UNIX for Dummies Questions & Answers 0 03-03-2006 03:34 AM
Game spy arcade for halo and macintosh? memattmyself Shell Programming and Scripting 1 05-07-2002 05:30 PM
Unix for Macintosh Icarus Where do I download LINUX & UNIX? 9 11-14-2001 09:45 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-29-2008
Registered User
 

Join Date: May 2008
Posts: 4
macintosh

hello,
i am new to this forum. i own a macbook pro running mac os x 10.5.2 leopard. just wondering, if these forums will help me? i work a lot in an application called terminal, it is apples command line. i like programming and have questions, like there was a post about text scrolling, the person who started the thread asked when using cat and page is there a way to have the text scroll or slowly move across the screen. there was a couple of programs in the thread that looked interesting to me. when you are talking about a script, what is this? like what language are you talking about? in the same thread there was a post of a c program. i tried to paste the c program into a text editor, and then compile it. the program compiled with out any errors but when i went to run it nothing seemed to happen. i am wondering if the reason it didn't work was because i am running a mac? i can re-post the program if any one wanted me to?

also how do i post code on this forum?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-29-2008
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 674
Scripts can be written in a variety of languages, but usually we are talking about shell scripts unless it's othewards specified.
A shell script is essentially just a collection of command lines, in sequence, so should work on your Mac just fine.

C code is a compiled language so you'll need to take the c-code and run it through a c compiler (gcc for example) to produce a compiled application before you can run it. Scripts don't have this requirement - you can just paste them into an editor and run them.

Wrap CODE tags round text to have it displayed correctly as code:
eg:
[CODE[
your code
[/CODE[

Last edited by Smiling Dragon; 05-29-2008 at 03:34 PM.
Reply With Quote
  #3 (permalink)  
Old 06-02-2008
Registered User
 

Join Date: May 2008
Posts: 4
there was a c program which i got from this website. i pasted the program into a text editor. i then compiled the program, and it compiled without any errors. but when i went to run the program nothing seemed to happen. the program was supposed to scroll text slowly accross the screen. just wondering what i am doing wrong?
one question i have is the command to run the program, i tried the following:

Code:
./nodoff.out 500 filename
where filename is the name of a file in my current working directory. one thing i will mention is that i am running mac os x 10.5.2 leopard. i am using terminal and a gcc compiler. i don't know if the fact that i am running leopard should have an effect on the computer not being able to run the c program?
here is the source file of the program which i called nodoff.c:

Code:
#ifdef __STDC__
#define PROTOTYPICAL
#endif
#ifdef __cplusplus
#define PROTOTYPICAL
#endif

#include <stdlib.h>
#include <sys/time.h>

#ifdef PROTOTYPICAL
int main(int argc, char *argv[])
#else
main(argc,argv)
char *argv[];
#endif

{
        int millisecs, microsecs;
        struct timeval tv;

        millisecs=atoi(argv[1]);
        microsecs=millisecs*1000;

        tv.tv_sec=microsecs/1000000;
        tv.tv_usec=microsecs%1000000;

        select(0, NULL, NULL, NULL, &tv);
        exit(0);
}
any help would be appreciated.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0