Professional Web Applications Themes

Porting code to Mac - Mac Programming

Hi, I've encountered a few problems porting some Windows code over to the Mac, and I'm wonderring if someone could help me with one or more of these problems ... Development Environment : iBook, OSX 10.2.4, Project Builder, Carbon C++ Application, 1) How can I determine the current Up/Down state of the shift, Ctrl, and Apple keys? 2) What happened to 'strnicmp' is that just something supported only by MSVC? I can write it myself but would rather use a standard function 3) The source code contains a line like this ... int handle = open(filename, O_RDONLY | O_BINARY); which ...

  1. #1

    Default Porting code to Mac

    Hi, I've encountered a few problems porting some Windows code over to the
    Mac, and I'm wonderring if someone could help me with one or more of these
    problems ...

    Development Environment : iBook, OSX 10.2.4, Project Builder, Carbon C++
    Application,

    1) How can I determine the current Up/Down state of the shift, Ctrl, and
    Apple keys?
    2) What happened to 'strnicmp' is that just something supported only by
    MSVC? I can write it myself but would rather use a standard function
    3) The source code contains a line like this ... int handle =
    open(filename, O_RDONLY | O_BINARY);
    which opens a binary file for reading. ProjectBuilder is rejecting the
    O_BINARY flag, (According to MSVC, it should be declared in 'fcntl.h'.
    4) Quite often, I receive a compile error like "Build failed" with no other
    details provided ... no other text exists in the build window. Is there
    anything I can do to get more information about what went wrong?

    One other question (not really a programming question) ... Is there a way
    that I can either tell the Mac to ignore file ownership (eg: I log on as
    Steve (Admin User), and want to modify files owned by another user (which is
    used by the windows server to send over file updates), or alternatively,
    some way to ensure that it doesn't try to block me out of those files until
    I change the ownership of them?

    Thanks for your help.

    - Stephen Fraser


    Stephen Fraser Guest

  2. #2

    Default Re: Porting code to Mac

    In article <030820030017122555%osxNOSPAMjwwalker.com.invalid >,
    "James W. Walker" <osxNOSPAMjwwalker.com.invalid> wrote:
    > In article <3f2c9a9f_1news.iprimus.com.au>, Stephen Fraser
    > <fraserq1iprimus.com.au> wrote:
    >
    > > 3) The source code contains a line like this ... int handle =
    > > open(filename, O_RDONLY | O_BINARY);
    > > which opens a binary file for reading. ProjectBuilder is rejecting the
    > > O_BINARY flag, (According to MSVC, it should be declared in 'fcntl.h'.
    >
    > Go to the Terminal and type "man 2 open". You'll see that O_BINARY
    > isn't one of the listed options. I don't usually use BSD APIs, but I
    > would suppose that it is automatically binary.
    Yep. I believe O_BINARY is specific to MS-DOS, where it tells the OS to
    avoid doing line ending conversion (or something like that). It isn't
    used on any common Unix system.

    -Eric

    --
    Eric Albert [email]ejalbertstanford.edu[/email]
    [url]http://rescomp.stanford.edu/~ejalbert/[/url]
    Eric Albert Guest

  3. #3

    Default Re: Porting code to Mac

    Hi Stephen,


    "Stephen Fraser" <fraserq1iprimus.com.au> writes:
    > 3) The source code contains a line like this ... int handle =
    > open(filename, O_RDONLY | O_BINARY);
    > which opens a binary file for reading. ProjectBuilder is rejecting the
    > O_BINARY flag, (According to MSVC, it should be declared in 'fcntl.h'.
    Unix systems don't have the text/binary distinction. Therefore the
    native Unix APIs don't need O_BINARY. In code that is supposed to be
    portable to Windows you can write:

    #include <fcntl.h>
    #ifndef O_BINARY
    # define O_BINARY 0
    #endif

    You can also avoid the Unix API and use C <stdio.h> instead. The "b"
    flag for fopen() is valid on all systems, even if Unix system ignore
    it.

    Other people like other solutions.


    benny
    Benjamin Riefenstahl Guest

Similar Threads

  1. Porting from CS to 10... can it work?
    By JeffreyBower@adobeforums.com in forum Adobe Illustrator Windows
    Replies: 3
    Last Post: April 13th, 03:40 PM
  2. porting to windows NT
    By Shaunn Johnson in forum PERL Beginners
    Replies: 3
    Last Post: January 30th, 02:26 PM
  3. Help need to porting from MS SQL to DB2 8.1
    By James Hong in forum IBM DB2
    Replies: 5
    Last Post: September 25th, 09:29 AM
  4. porting to pc
    By cwf prod webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 1
    Last Post: August 12th, 02:56 PM
  5. Porting code to Mac (part 2)
    By Eric Albert in forum Mac Programming
    Replies: 0
    Last Post: August 10th, 01:08 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139