Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

arjit

macrumors newbie
Original poster
Feb 20, 2009
18
0
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
 

chown33

Moderator
Staff member
Aug 9, 2009
10,739
8,415
A sea of green
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?
 

arjit

macrumors newbie
Original poster
Feb 20, 2009
18
0
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
 

chown33

Moderator
Staff member
Aug 9, 2009
10,739
8,415
A sea of green
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/libr...ference/File_Manager/Reference/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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.