struct type redefinition

5 03 2009

the header file may be included twice. use #ifndef to prevent multiple definitions

#ifndef COMMON_H
#define COMMON_H
#include "Common.h"
#endif /* COMMON_H */

#ifndef = if not defined
#ifdef = if defined





Run Applescript in Carbon

7 11 2007

Found in Apple Developer Connection

Example

SimpleRunAppleScript(
"tell application \"Finder\"\n"
" activate\n"
" select folder \"Documents\" of startup disk\n"
" open selection\n"
"end tell");





Open & Read File

7 11 2007

char filename[] = "input.txt";
ifstream inFile;
int size;
inFile.open(filename,ios::in);
if(!inFile) {
return -4;
}
size = (int) inFile.tellg();
char mySerial[size];
while(!inFile.eof()) {
inFile >> mySerial;
}
inFile.close();