Professional Web Applications Themes

File Manager file name max length? - Mac Programming

Hi, Is it possible to create files with names longer than 32 characters? I'm getting 'Bad Filename' errors from the following calls with long names: err = ::FSMakeFSSpec(destFSSpec.vRefNum, nodeID, fileName, &clipSpec); err = ::FSpCreate(&clipSpec, 'text', 'TEXT', 0); It's possible in the Finder, so what's the problem? Thanks Steve...

  1. #1

    Default File Manager file name max length?

    Hi,
    Is it possible to create files with names longer than 32 characters?

    I'm getting 'Bad Filename' errors from the following calls with long names:

    err = ::FSMakeFSSpec(destFSSpec.vRefNum, nodeID, fileName, &clipSpec);
    err = ::FSpCreate(&clipSpec, 'text', 'TEXT', 0);

    It's possible in the Finder, so what's the problem?

    Thanks

    Steve

    Steve Guest

  2. #2

    Default Re: File Manager file name max length?

    On Wed, 11 Feb 2004, Steve James wrote:
     
    Yes, but not with the FSSpec APIs. You need to use the newer FSRef APIs

    Fred 

    Frederick Guest

  3. #3

    Default Re: File Manager file name max length?

    Thanks, Fred, got it.
    Amazingly, there's zero references in the File Manager docs as to what
    to do with a 32+ C string if you need to turn it in to a HFSUniStr255.
    For anyone with the same headache it's buried in ' Text Encoding
    Conversion Manager Reference' : ConvertFromPStringToUnicode().

    Steve



    Frederick Cheung wrote: 
    >
    > Yes, but not with the FSSpec APIs. You need to use the newer FSRef APIs
    >
    > Fred

    >
    >[/ref]

    Steve Guest

  4. #4

    Default Re: File Manager file name max length?

    In article <c0fdd7$rhd$btinternet.com>, Steve James
    <com> wrote:
     

    Typically, you use the CFString api.

    CFStringCreateWithPascalString or CFStringCreateWithCString

    then

    CFStringGetCharacters

    And when you modernize your app, you'll find you very very very rarely
    need to deal with pascal strings anymore - 99% of Carbon is
    Unicode/CFString-based at this point.
    Chris Guest

  5. #5

    Default Re: File Manager file name max length?

    I'm having to p text files from many different sources, which gets
    very complicated, and is error prone. So one of the reasons I've shyed
    away from the Unicode/CFString route is because it seems impossible to
    read these strings in the CW debugger, which is essential for what I'm
    doing. At the moment I can step through C or Pascal lines of text and
    see exactly what's happening. The others seem like black boxes.
    Hopefully, I'm missing something, and there's a way to have the best of
    both worlds.

    Steve

    Chris Baum wrote: 
    >
    >
    > Typically, you use the CFString api.
    >
    > CFStringCreateWithPascalString or CFStringCreateWithCString
    >
    > then
    >
    > CFStringGetCharacters
    >
    > And when you modernize your app, you'll find you very very very rarely
    > need to deal with pascal strings anymore - 99% of Carbon is
    > Unicode/CFString-based at this point.[/ref]

    Steve Guest

  6. #6

    Default Re: File Manager file name max length?

    In article <c0hq58$fge$btinternet.com>,
    Steve James <com> wrote:
     

    Metrowerk's debugger has a menu command to show you unicode strings
    directly, and as for CFStrings, if you'd read the debugger release
    notes, you'd see how a simple single change to your application allows
    the debugger to show these to you too.
    David Guest

  7. #7

    Default Re: File Manager file name max length?

    Thanks very much for the advice, I've had a play with CFStrings in the
    DataViewer now, and no doubt it'll be useful sometimes.

    However, when parsing text files (and ending up with large arrays of
    words and tokens) P strings (actually LStrings) are still faster and
    easier to use. (make an array of 100 CFStrings and then look for the one
    that says "xyz" in the debugger). With L/P/C strings it's instant.

    I _do_ take the point though, that for Carbon functionality, it's been
    worth making the swap. With the conversion routines, I can have the best
    of both worlds.

    Steve


    David Phillip Oster wrote:
     
    >
    >
    > Metrowerk's debugger has a menu command to show you unicode strings
    > directly, and as for CFStrings, if you'd read the debugger release
    > notes, you'd see how a simple single change to your application allows
    > the debugger to show these to you too.[/ref]

    Steve Guest

Similar Threads

  1. How to get the length of wav file?
    By lgj573@gmail.com in forum PERL Modules
    Replies: 4
    Last Post: April 11th, 04:26 PM
  2. FLV file length
    By Dan Powell in forum Macromedia Flash Flashcom
    Replies: 2
    Last Post: March 13th, 06:00 PM
  3. File Path Length Problem
    By R._Max_Kennedy@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 7
    Last Post: June 10th, 10:00 AM
  4. Aix File Name Length
    By CL in forum AIX
    Replies: 3
    Last Post: February 6th, 10:56 PM
  5. File Manager?
    By Amanda Jones in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 4
    Last Post: August 4th, 06:02 PM

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