Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Help please

Help please
Thread Tools
Fresh-Faced Recruit
Join Date: Oct 2004
Status: Offline
Reply With Quote
Jun 16, 2005, 09:19 PM
 
Right now i am learning about disk files in C and i need to know the filename rules and directory stuff for mac os x. If any one could show me were to find this info it would be helpful.
     
Junior Member
Join Date: Nov 2001
Location: Seattle
Status: Offline
Reply With Quote
Jun 19, 2005, 01:33 AM
 
Originally Posted by lord vader
Right now i am learning about disk files in C and i need to know the filename rules and directory stuff for mac os x. If any one could show me were to find this info it would be helpful. :)
File I/O is the same in C for Mac OS X as for other operating systems. (Perhaps I'm not understanding your question?) For example, this code should make a new file called "readme" that contains the text "hello world!"; it should work on a variety of platforms, including a Mac:

Code:
#include <stdio.h> int main() { FILE *fp; fp = fopen("/Users/yourname/readme", "w"); if (fp) { fprintf(fp, "hello world!\n"); fclose(fp); } else { printf("Could not open the file '/Users/yourname/readme'\n"); } return 0; }
[Of course the indentation is all messed up!] If you're trying to find out about the functions for reading from/writing to files in C (fopen, scanf, printf, etc.) then just do a search for "C file I/O" or something like that; I'm sure there are lots of references.
     
   
Thread Tools
Forum Links
Forum 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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:16 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2