Mac Carbon |
Author |
Message |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Mar 01, 2007 11:00 pm Post subject: Files & Networking |
|
|
iDevGames: Reading/writing files in Carbon?
"stdio works fine in a Carbon or Cocoa application, but your initial working
directory may not be where you expect it to be. It's different when running
from Xcode than when launched from the Finder or in other situations."
Last edited by delovski on Thu Nov 18, 2010 8:37 pm; edited 1 time in total |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Mar 03, 2007 12:11 pm Post subject: |
|
|
DaniWeb: How to get path of current appl (in char) for Mac OS X
Code: | #include <unistd.h>
#include <iostream>
#define SIZE 1200
int main()
{
using namespace std;
char folder[SIZE];
getcwd(folder, SIZE);
cout << "This is the path = " << folder << endl;
} |
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Mar 10, 2007 12:34 am Post subject: |
|
|
MacRumors - Forums: xcode and input files
"You can set the working directory for your executable in the 'General' tab
in the info window for the executable. To get this window select 'Edit Active
Executable' under 'Projects' in the menu bar. Just set it to whatever you
want." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Mar 23, 2007 1:10 am Post subject: |
|
|
comp.sys.mac.programmer.help - Set file Read Only...
"FSSetCatalogInfo can also change the permissions. The FSCatalogInfo
structure has a permissions field that can be interpreted as a FSPermissionInfo
structure. You'd want the kFSCatInfoPermissions flag in the whichInfo argument." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Mar 25, 2007 2:13 am Post subject: |
|
|
Can't find the info I need - any help out there???
"The Open dialog box, and the 'odoc' event both return an aeList of aeDescriptors
that represent file paths. ideally, you should write your code so that you pass
the aeList to a common handler." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Apr 15, 2007 2:18 am Post subject: |
|
|
What the heck??? FSRefMakePath() weirdness
"Instead of getting back good results like above, for each pass through
the loop, I get a Result value of -2110 (Which I've looked up and found
to be "PathTooLong") a PathLength value of 2, and ThePathBuff holding
absolutely nothing." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun May 06, 2007 1:21 pm Post subject: |
|
|
FSFindFolder - Folder Manager Reference
"Obtains location information for system-related directories."
Code: | OSErr FSFindFolder (
short vRefNum,
OSType folderType,
Boolean createFolder,
FSRef * foundRef
); |
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3043 Location: Europe
|
Posted: Wed May 09, 2007 4:52 pm Post subject: |
|
|
ADC: FSCompareFSRefs - File Manager Reference
Code: | OSErr FSCompareFSRefs (
const FSRef *ref1,
const FSRef *ref2
); |
If the two FSRef structures refer to the same file or directory, then noErr
is returned. If they refer to objects on different volumes, then diffVolErr is
returned. If they refer to different files or directories on the same volume,
then errFSRefsDifferent is returned.
You must use FSCompareFSRefs ... to compare FSRef structures. It is not
possible to compare the FSRef structures directly since some bytes may be
uninitialized, case-insensitive text, or contain hint information. |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun May 20, 2007 12:22 am Post subject: |
|
|
Carbon List: Setting file type
"The CatalogInfo has the finderInfo removed and replaced with an array to
fill the missing space. The docs on Apple's website say 'The File Manager
does not interpret the contents of these fields'.
The only API's I can find to change the file type/creator require the use of
FSSpec's. I know I must be missing something."
Related example at CarbonDev: SetFinderInfo shows how to fill in the Finder
info for FileType and FileCreator. Make sure you see File Manager page while
you're there. |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3043 Location: Europe
|
Posted: Sun May 20, 2007 6:18 pm Post subject: |
|
|
ADC: TN2037 - Exclusive File Access in Mac OS X
"Mac OS X's BSD subsystem does not enforce file read/write privileges in
the same way as classic Mac OS. Opening a file for writing does not ensure
other processes can not write to the same file. The default behavior of BSD
allows for multiple 'writers' to a single file." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3043 Location: Europe
|
Posted: Tue Jun 19, 2007 3:02 pm Post subject: |
|
|
Get Percent of Disk Used in a C/C++ program
"FSGetVolumeInfo will fill out a FSVolumeInfo structure. These fields in
that structure are of interest:
UInt32 blockSize;
UInt32 totalBlocks;
UInt32 freeBlocks;" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3043 Location: Europe
|
Posted: Fri Sep 28, 2007 9:56 pm Post subject: |
|
|
adc - TN2015 - Locating Application Support Files under Mac OS X
"Apple recommends that such files are stored in special folders such as the
Application Support, Scripting Additions, Scripts, and Internet Plug-Ins folders,
which can be located using the FindFolder API that works transparently on Mac
OS 8, 9, and Mac OS X, but some developers prefer to store those files in
folders located adjacent to the related application.
In order to locate those files, the application has to locate itself first." |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Fri Nov 16, 2007 4:50 pm Post subject: |
|
|
xcode-users - -42 errors and GDB...grrrr
"Turns out that normally the default number of open files allowed is 256 but
when an app is running in GDB it's RLIM_INFINITY (10240 to be exact)." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed May 14, 2008 6:08 pm Post subject: |
|
|
Where to Put Application Files
"For information about the purpose and intended content of specific Library
subdirectories, see “The Library Directory.”
Contents:
Support Files
Plug-Ins
Temporary Files
Cache Files
Don’t Pollute User Space" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Nov 10, 2008 3:58 am Post subject: |
|
|
TN2037 - Exclusive File Access in Mac OS X
"This document discusses the issues surrounding obtaining exclusive file
access in current versions of Mac OS X and how it differs from classic Mac
OS. Exclusive file access is an issue which affects all Mac OS X developers,
Carbon, Cocoa, Java, and BSD." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Nov 18, 2010 8:38 pm Post subject: |
|
|
purplebeanie.com - Core Foundation for FTP
"First of all I was really surprised at how quick it was to actually get a fairly
rudimentary FTP solution up and running using Core Foundation." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3043 Location: Europe
|
Posted: Mon Feb 25, 2013 9:47 pm Post subject: |
|
|
ADC - libcurl - client-side URL transfers
"This is a short overview on how to use libcurl in your C programs. There
are specific man pages for each function mentioned in here.
There are also the libcurl-easy(3) man page, the libcurl-multi(3) man
page, the libcurl-share(3) man page and the libcurl-tutorial(3) man page
for in-depth understanding on how to program with libcurl." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3043 Location: Europe
|
Posted: Mon Feb 25, 2013 9:48 pm Post subject: |
|
|
curl.haxx.se - Using The libcurl C Interface
"There's the tutorial to start with, read the tutorial to get a general in-depth
grip of what libcurl programming is all about.
There are some example C source codes you can check out. They're not
all-covering or even very extensive, but they might serve as a source of
inspiration to start hacking."
For a small example that shows how to use a client certificate with libcurl,
see this: simplessl.c |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3043 Location: Europe
|
Posted: Thu Oct 12, 2023 8:30 am Post subject: |
|
|
adc - Resolving Aliases
"To resolve aliases in a path contained in an NSString, you need to first convert
the string to a URL, convert the URL to an FSRef, resolve the alias, and reverse
the series of conversions to yield another NSString." |
|
Back to top |
|
|
|