How to write to a file including full directory in C under Unix?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jameskuyper@verizon.net

    #61
    Re: How to write to a file including full directory in C under Unix?

    Walter Roberson wrote:
    In article <FDzok.704$EL2. 457@trnddc01>,
    James Kuyper <jameskuyper@ve rizon.netwrote:
    >
    Why should someone who's willing to restrict the portability of his
    program to POSIX systems (not exactly a severe limitation - I haven't
    written a program for a non-POSIX system in the last 14 years)
    >
    >
    Most versions of MS Windows are not POSIX. And I'm not just speaking
    historically: there is no POSIX available for XP Home, Vista Starter,
    Vista Home, Vista Home Premium, or Vista Business.
    Well, I've never had to write a program for any of those platforms.
    The last time I had to write a Windows program was for Windows 3.1,
    and as I said, that was more than 14 years ago. Sure, there's a huge
    market for Windows software, but the market for POSIX software, while
    admittedly smaller, isn't exactly tiny.

    As a matter of fact, I think my C code probably can be ported to
    Windows machines without too much effort, though I haven't tried it -
    but I don't know where I could find a machine to try it on. The
    programs I've been working on over these last 14 years do not
    generally rely upon POSIX facilities for anything but the make files.
    The main constraint on their portability is three third-party
    libraries; anywhere those libraries can be installed, my C code can be
    compiled, and should execute correctly. All three libraries can be
    installed on Windows XP machines using MSVC++ as the C compiler. As
    far as I know, installation on Vista platforms hasn't been tested yet;
    apparently it isn't a high priority for users of those libraries.

    Comment

    • santosh

      #62
      Re: How to write to a file including full directory in C under Unix?

      Kenny McCormack wrote:
      but the clc regs need to realize
      that, in a very real sense, the student is always right, too. I.e.,
      the student (in clc, that means the newbie questioner) knows what he
      needs to know,
      No. This is wrong. Very often newbies don't know of possible better
      solutions to their problems.

      Comment

      • Kenny McCormack

        #63
        Re: How to write to a file including full directory in C under Unix?

        In article <g80uvi$7e4$1@r egistered.motza rella.org>,
        santosh <santosh.k83@gm ail.comwrote:
        >Kenny McCormack wrote:
        >
        >but the clc regs need to realize
        >that, in a very real sense, the student is always right, too. I.e.,
        >the student (in clc, that means the newbie questioner) knows what he
        >needs to know,
        >
        >No. This is wrong. Very often newbies don't know of possible better
        >solutions to their problems.
        >
        heh - santosh thinks I'm wrong. I guess that must make it so (NOT).

        It appears you don't get what I mean when I say "The <Xis always right".

        Think about it - it will come to you.

        Comment

        • Richard Bos

          #64
          Re: How to write to a file including full directory in C under Unix?

          CBFalconer <cbfalconer@yah oo.comwrote:
          Keith Thompson wrote:
          No, it does not *always* reduce your portability.

          Or do you claim that
          system("mkdir foo");
          is more portable than
          mkdir("foo", 0777);

          The OP needs to create a directory. That's a specific reason to
          use POSIX functions.
          >
          That is covered above by 'specific reasons'. However the program
          without any mkdir will compile and execute on more systems than the
          program with mkdir.
          That's what you think. For mkdir, you may even be correct, because that
          command happens to be called the same thing on MS-DOS as under Unix. Now
          try the same thing with "dir".
          That's increased portability.
          Not in practice, it isn't.

          Richard

          Comment

          • Bill Reid

            #65
            Re: How to write to a file including full directory in C under Unix?


            Sheesh, just looked at this old post, somebody musta defecated
            in his scrambled eggs that morning...

            Walter Roberson <roberson@ibd.n rc-cnrc.gc.cawrote in message
            news:g7rgc6$5fv $1@canopus.cc.u manitoba.ca...
            In article <695ok.303096$S V4.192978@bgtns c04-news.ops.worldn et.att.net>,
            Bill Reid <hormelfree@hap pyhealthy.netwr ote:
            >
            What you're really looking for is something called "POSIX",
            which was initially developed based on Unix, but could potentially
            apply to any computer system, and as a matter of fact is
            included in the "C" compilers for many different types of
            systems.
            >
            POSIX is included in the C compilers for "many different types of
            systems"?? Would I be likely to recognize the names of any of
            those systems??
            Sure. Think "Evil Empire"...
            POSIX is the "Portable Operating System Interface". A C compiler
            does not implement operating system interfaces: to do so would
            take them out of the realm of being *operating system* interfaces
            into the realm of being *application* entities.
            Come on, you know what I meant, that either totally-conforming or
            "POSIX-like" C function calls are included in some C compilers. Mine
            does, but I dare not breathe the name of the "system" for fear that
            Lord Gater will use his mind to choke me...
            Sometimes C compilers bundle in, as extensions, header files useful
            with POSIX -- but the operating system behaviours are left to
            the operating system to implement, not delivered by the C compiler.
            Hmmmmm, "header files", hmmmmm...all I know is that I can call
            a function that does what the OP wanted to do (of course, what the OP
            wanted to do is always forgotten in these "discussion s") in my compiler,
            because it includes a bunch of functions that have either identical
            or similar signatures and usage as are specified by POSIX...
            Are you aware of the following, Bill?
            >

            >
            POSIX and OS/2 are not supported in Windows XP or in Windows Server 2003
            OMG!!! Who woulda thunk it!!?!!!

            The truly hilarious thing is that if "Windows" "supported" POSIX, then
            it could be legally called "Unix"!!!! And even more hilariously, "Windows"
            may be more POSIX compliant than "Linux"!!!!
            Overview
            Utilities and SDK for UNIX-Based Applications is an add-on to the
            Subsystem for UNIX-Based Applications (referred to as SUA, hence
            forth) component that shipped in Microsoft Windows Vista /
            Windows Server 2008 RTM. [...]
            >
            System Requirements
            >
            * Supported Operating Systems: Windows Server 2008; Windows
            Vista Enterprise; Windows Vista Enterprise 64-bit edition;
            Windows Vista Service Pack 1; Windows Vista Ultimate; Windows
            Vista Ultimate 64-bit edition
            >
            If it was just a matter of having the right C compiler, then why
            the restrictions on the supported editions? Why no support for
            Vista Starter, Vista Home, Vista Home Premium, or Vista Business ?
            It must be some sort of illegal monopolistic strategy, of course.

            Look, you're just being argumentative for no apparent reason.
            If you want to make a directory in a C program, you're gonna have
            to use an "extension" of some sort. As has been discussed to
            death, I think it might behoove you to use an extension that
            conforms to POSIX as much as possible, for the sake of the
            sacred "portabilit y" at the source level, but if you want to use
            direct calls to a system designed by the guy who killed Obi
            Wan-Kenobi to each his own...

            ---
            William Ernest Reid

            Comment

            • Lew Pitcher

              #66
              Re: How to write to a file including full directory in C under Unix?

              On October 12, 2008 12:50, in comp.lang.c, Bill Reid
              (hormelfree@hap pyhealthy.net) wrote something completely off-topic for
              comp.lang.c:
              [snip]
              > POSIX and OS/2 are not supported in Windows XP or in Windows Server
              > 2003
              >
              OMG!!! Who woulda thunk it!!?!!!
              >
              The truly hilarious thing is that if "Windows" "supported" POSIX,
              What do you mean by "if"? Haven't you heard about Windows SFU (Services for
              Unix)?
              then it could be legally called "Unix"!!!!
              Not without certification from the Open Group.

              But, POSIX support is not Unix support. POSIX compliance simply gets
              Microsoft past the US GAO requirement that all computer systems purchased
              by US Federal agencies /must/ support POSIX. (Does that requirement still
              exist?)
              And even more hilariously, "Windows" may be more POSIX compliant
              than "Linux"!!!!
              Don't know. Don't care. Most Windows programmers do not write POSIX
              applications for Windows. It matters not if Microsoft supplies a POSIX
              environment for Windows, when no one uses it.

              In practical terms, Linux apps are more POSIX-compliant than Windows apps,
              and (unlike Windows), Linux /comes/ with POSIX compatability.


              --
              Lew Pitcher

              Master Codewright & JOAT-in-training | Registered Linux User #112576
              http://pitcher.digitalfreehold.ca/ | GPG public key available by request
              ---------- Slackware - Because I know what I'm doing. ------


              Comment

              Working...