LinuxQuestions.org
Help answer threads with 0 replies.
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 02-06-2008, 04:39 PM   #1
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Rep: Reputation: 35
Compiling a C program to Mac OSX


Sorry by the lazyness, but is just Im needing this very quickly and there is no time to learn C, so I think that maybe someone could help me with the code to run this commmand: "mount -t msdos /dev/disk1s1 /mnt/disk".

I was thinking making in C and place in the desktop of the users (I will modify a litle the command line above) I tried just a exec file but Mac OSX opens it on the editor...

Thanks!
 
Old 02-06-2008, 09:54 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
What’s wrong with using a script? Did you give it correct (i.e., execute) permissions?
 
Old 02-07-2008, 06:22 PM   #3
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Original Poster
Rep: Reputation: 35
Isnt user friendly and will make the user to go to the console everytime he want to load the script, and the user isnt used to shell.

So I think that an icon on the desktop could be mutch more easy.

=)
 
Old 02-07-2008, 07:35 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by maginotjr View Post
So I think that an icon on the desktop could be mutch more easy.
I thought you could click-to-execute a script the same way you click-to-execute a binary (as long as both of them have execute permissions). I haven’t used OSX in awhile, but I thought that’s how it worked.

If not, you can always use execl() in a C program:
Code:
execl("/path/to/script", "0th argument", "1st argument", "2nd argument", "3rd argument", 0);
the 0th argument is usually the basename of the file. The rest of the arguments are what you normally think of as arguments. The last parameter of the function is a 0, and tells the C library that you are done passing parameters.
 
Old 02-07-2008, 08:33 PM   #5
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
You just need to figure out how to do it properly in Mac OS X. You can have a script on the desktop that just does what it is supposed to do rather than opening the console or editor. I'd have to dig into it to see how, but the Mac specialist at work does that for the computer lab all the time.
 
Old 02-08-2008, 12:10 PM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
[quick and dirty]
Code:
#include "stdio.h"

main(int argc, char *argv[])
{
        system("mount -t msdos /dev/disk1s1 /mnt/disk"); // consider using -t vfat
// not sure what /dev/disk1s1 refers to but i assume its like /dev/hda1
}
does mac have gcc ? i remember making a skype like script to cat /dev/dsp to an open port but mac doesnt have netcat. you might be able to compile this on linux and scp the program-binary to the mac system (it should run since osx is posix compliant and now use x86 processors). else dual boot (is there a live-cd available for mac) and use the gcc on linux to compile the program on the mac hardware after mounting the mac harddrive.

im sorry this is all theoretical but i dont have a mac to test this out on but i am still curious to know what works and what doesnt.

Last edited by schneidz; 02-08-2008 at 12:15 PM.
 
  


Reply



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
need to get ISO for Mac OSX (10.5.1) how? where? rubenzall Linux - Newbie 1 01-17-2008 10:46 PM
MAC OSX on intel blackzone General 10 07-31-2006 10:21 PM
error while compiling openDChub on Mac OSX 10.3.2 stevejob Linux - Software 0 03-10-2004 04:27 PM
Mac OSX friekman Linux - Newbie 2 08-14-2003 08:56 PM
Mac OSX 10.2 jpc82 Linux - General 14 12-03-2002 10:22 AM

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

All times are GMT -5. The time now is 06:41 AM.

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