LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-29-2011, 05:16 AM   #1
ankitm
Member
 
Registered: Sep 2011
Posts: 33

Rep: Reputation: Disabled
Query regarding open in c


Hi
my code is

while(true)
{
file_desc=open("/monitor",O_RDONLY);
if(file_desc<0)
{

}
close(file_desc);

}
It is satisfying file_desc<0 only when process starts. If I manually the file it is not going inside if

Do we need to give fflush for it ?

Please suggest
 
Old 11-29-2011, 07:00 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hello,

I noticed that you have marked your thread as solved; If so, could you share your solution with the rest of us? Thanks!

Cheers,

Josh
 
Old 11-29-2011, 07:03 AM   #3
ankitm
Member
 
Registered: Sep 2011
Posts: 33

Original Poster
Rep: Reputation: Disabled
Hi,
It doesnt require fflush .

It works fine as shown .
 
  


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
Bind open to query from anyone noir911 Linux - Server 1 01-05-2009 07:43 AM
interesting MySQL query/view query :s mjh Programming 3 03-25-2008 07:30 AM
mysql use output of one query in another query secretlydead Programming 2 11-19-2007 01:25 AM
help with mysql query: return nth rows in query hawarden Programming 2 07-31-2006 06:36 PM
open/query remote udp sockets in shell macie Programming 2 03-20-2005 03:45 PM

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

All times are GMT -5. The time now is 01:37 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