Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 20, 2009, 06:15 AM   #1
arjit
macrumors newbie
 
Join Date: Feb 2009
Making a log file in Xcode Application

I am trying to make log file in for my application now when the program starts i need the file to deleted if it exits and appened in many times in the program how to solve this i FSCreateFileUnicode this but its not working.

any help would be appreciated thanks
arjit is offline   0 Reply With Quote
Old Nov 20, 2009, 10:55 AM   #2
Catfish_Man
macrumors 68030
 
Catfish_Man's Avatar
 
Join Date: Sep 2001
Location: Portland, OR
Send a message via AIM to Catfish_Man
Why not use the system log via CFLog() or Apple System Logger (http://developer.apple.com/mac/libra...3/asl.3.html)?
Catfish_Man is offline   0 Reply With Quote
Old Nov 20, 2009, 01:55 PM   #3
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by arjit View Post
I am trying to make log file in for my application now when the program starts i need the file to deleted if it exits and appened in many times in the program how to solve this i FSCreateFileUnicode this but its not working.
What error does FSCreateFileUnicode return when it doesn't work?
chown33 is offline   0 Reply With Quote
Old Nov 22, 2009, 11:14 PM   #4
arjit
Thread Starter
macrumors newbie
 
Join Date: Feb 2009
Quote:
Originally Posted by chown33 View Post
What error does FSCreateFileUnicode return when it doesn't work?
Actually it shows dup error whcih shows the file exits ... so there is function which could create the file when the program starts and keeps on appending it .

thanks in advnace
arjit is offline   0 Reply With Quote
Old Nov 22, 2009, 11:52 PM   #5
chown33
macrumors 603
 
Join Date: Aug 2009
That doesn't make sense.

If the file exists, then there's no need to create it. Simply open it for writing and append your data.

If the file doesn't exist, then create it before opening it.

There are functions for opening existing files for writing. Read the FileManager docs. Look for FSOpenFork.

http://developer.apple.com/mac/libra...reference.html

You can also use the C standard I/O function fopen(), and it will handle creation, appending, etc. when given the right parameters.

Last edited by chown33; Nov 22, 2009 at 11:59 PM.
chown33 is offline   0 Reply With Quote
Old Nov 23, 2009, 12:56 PM   #6
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
Quote:
Originally Posted by Catfish_Man View Post
Why not use the system log via CFLog()
Isn't CFLog private though?
kainjow is offline   0 Reply With Quote
Old Nov 23, 2009, 06:04 PM   #7
Catfish_Man
macrumors 68030
 
Catfish_Man's Avatar
 
Join Date: Sep 2001
Location: Portland, OR
Send a message via AIM to Catfish_Man
err, s/CFLog/NSLog then.
Catfish_Man is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Viewing files in application bundle created on iPhone RonC iPhone/iPad Programming 2 Aug 30, 2011 11:50 AM
Compiling C Files in Xcode is not working - warning: no rule to process file Reini iPhone/iPad Programming 3 Feb 20, 2011 01:25 PM
Problem opening a *.txt file in Xcode Command Line Application Averello Mac Programming 2 Dec 23, 2009 08:46 AM
TabStop in XCode application (ObjC) satyam90 Mac Programming 1 Jun 10, 2008 06:08 AM
ridiculously large log files, and all applications are gone. phuong Mac Basics and Help 9 Apr 30, 2007 06:05 AM


All times are GMT -5. The time now is 10:14 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC