LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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

Closed Thread
 
LinkBack Search this Thread
Old 09-06-2007, 02:56 PM   #1
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-12/ fc-11-live-usb/ aix
Posts: 1,829

Rep: Reputation: 134Reputation: 134
run c function in the background


for example in bash:
Code:
(
while [ 1 ]
do
 echo hello-world
 sleep 1
done) &
cd p2501
will go to the project-2501 directory while echo-ing hello-world in the background.

how does one do something similar in c ?

Code:
while(1)
{
 printf("hello-world\n");
 usleep(1000000);
}     // background ?
chdir("p2501");
i figure some mixture of fork but i dont want it to overwrite the current process in memory.

am i not understanding how fork works ?

thank you,

Last edited by schneidz; 09-06-2007 at 02:57 PM.
 
Old 09-06-2007, 03:05 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 38,405

Rep: Reputation: 884Reputation: 884Reputation: 884Reputation: 884Reputation: 884Reputation: 884Reputation: 884
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
run c function in the background schneidz Programming 4 09-07-2007 08:29 AM
poepn or system function call executed by a background process kshkid Programming 1 08-24-2006 04:04 AM
How do I run a function within a function arguement? C/C++ RHLinuxGUY Programming 12 05-19-2006 03:29 PM
how to run any binary in background - background process tej Linux - Newbie 1 08-16-2004 01:27 AM
alias or function in .bashrc, which sends command to background ngomong Linux - General 1 04-23-2002 10:50 PM


All times are GMT -5. The time now is 07:55 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration