Hi,
I'm creating simple logging function in my server application but i've come
to a little problem. I use fopen and fprintf to open and print to that file
and after the application quits fclose ofcourse but the data get's only
written when i use fclose, i need something so it gets written to the file
directly because otherwise the logging won't have much effect because i want
to run the program for long times. Is there any function to flush the buffer
to the file?
Thanks in Advance,
Robert Mens 6 1914
Robert <R.****@hetnet.nl> scribbled the following: Hi,
I'm creating simple logging function in my server application but i've come to a little problem. I use fopen and fprintf to open and print to that file and after the application quits fclose ofcourse but the data get's only written when i use fclose, i need something so it gets written to the file directly because otherwise the logging won't have much effect because i want to run the program for long times. Is there any function to flush the buffer to the file?
Try fflush().
--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Bad things only happen to scoundrels."
- Moominmamma
Robert <R.****@hetnet.nl> scribbled the following: Hi,
I'm creating simple logging function in my server application but i've come to a little problem. I use fopen and fprintf to open and print to that file and after the application quits fclose ofcourse but the data get's only written when i use fclose, i need something so it gets written to the file directly because otherwise the logging won't have much effect because i want to run the program for long times. Is there any function to flush the buffer to the file?
Try fflush().
--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Bad things only happen to scoundrels."
- Moominmamma
Robert wrote: Hi,
I'm creating simple logging function in my server application but i've come to a little problem. I use fopen and fprintf to open and print to that file and after the application quits fclose ofcourse but the data get's only written when i use fclose, i need something so it gets written to the file directly because otherwise the logging won't have much effect because i want to run the program for long times. Is there any function to flush the buffer to the file?
Surprisingly, it's called fflush().
Robert wrote: Hi,
I'm creating simple logging function in my server application but i've come to a little problem. I use fopen and fprintf to open and print to that file and after the application quits fclose ofcourse but the data get's only written when i use fclose, i need something so it gets written to the file directly because otherwise the logging won't have much effect because i want to run the program for long times. Is there any function to flush the buffer to the file?
Surprisingly, it's called fflush().
In <c5**********@oravannahka.helsinki.fi> Joona I Palaste <pa*****@cc.helsinki.fi> writes: Robert <R.****@hetnet.nl> scribbled the following: Hi,
I'm creating simple logging function in my server application but i've come to a little problem. I use fopen and fprintf to open and print to that file and after the application quits fclose ofcourse but the data get's only written when i use fclose, i need something so it gets written to the file directly because otherwise the logging won't have much effect because i want to run the program for long times. Is there any function to flush the buffer to the file?
Try fflush().
If it doesn't have the desired effect (the output is still buffered by
the OS, even if it left your program), close the file after logging each
item and reopen it in append mode before logging a new item. With some
network file systems this may be your only chance of forcing the output to
its final destination (short of using non-standard library calls).
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
In <c5**********@oravannahka.helsinki.fi> Joona I Palaste <pa*****@cc.helsinki.fi> writes: Robert <R.****@hetnet.nl> scribbled the following: Hi,
I'm creating simple logging function in my server application but i've come to a little problem. I use fopen and fprintf to open and print to that file and after the application quits fclose ofcourse but the data get's only written when i use fclose, i need something so it gets written to the file directly because otherwise the logging won't have much effect because i want to run the program for long times. Is there any function to flush the buffer to the file?
Try fflush().
If it doesn't have the desired effect (the output is still buffered by
the OS, even if it left your program), close the file after logging each
item and reopen it in append mode before logging a new item. With some
network file systems this may be your only chance of forcing the output to
its final destination (short of using non-standard library calls).
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jonathan |
last post by:
I have a client solution that requires data and associated files to be
stored with data in a database. As such, I have a situation where JPEG
thumbnails/images that are stored as BLOBs (image...
|
by: Andrei Pociu |
last post by:
I have a major doubt about outputting text in ASP .NET when using code
behind.
I know most of the output you gain from a code behind file (.aspx.cs) is
outputted to the Webform (.aspx) using...
|
by: JenHu |
last post by:
I have a vb.net application, which read the text file line by line and
write into SQL server tables. The text file contains the employees'
bank account number and all other information.
The way...
|
by: Ash Phillips |
last post by:
Ok, I'm not sure how I can explain this but here goes.
I have this program that uses a ListView for entries. What I have the
program doing is taking all the items from the listview, and writing...
|
by: runner7 |
last post by:
This is a question about outputting pure XML from PHP, such as to a
request object in an AJAX application. I would suppose that all I have
to do in my script is to add the line before any other...
|
by: Peter Nimmo |
last post by:
Hi,
I am writting a windows application that I want to be able to act as if
it where a Console application in certain circumstances, such as error
logging.
Whilst I have nearly got it, it...
|
by: phong.lee |
last post by:
Hello all,
I was wondering if someone can assist me in outputting 6 reports into
a pdf file? I created a macro that generates the 6 reports and right
now it's saved as a snapshot on my drive. ...
|
by: mohaakilla51 |
last post by:
Alright guys, I am working on a flashcard script... Previously I had it so that it onlty had predefined categories. People were complaining, so now I am trying to make it to where it reads...
|
by: billelev |
last post by:
This is probably a very easy question to answer:
I have been outputting some text to a message box, similar to the following:
strOutput = "---" & Chr(10) & Chr(10)
strOutput = strOutput &...
|
by: Ellie |
last post by:
I have a VB6 program upgraded to vb.net and I need to use the printline
function to write to a text file but I need certain characters in bold.
Would anyone be able to tell me how to do this, if...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |