I develop on Windows but my question is may my C code be ported and EOF work on both

Discussion in 'Programming' started by Onceler, Feb 18, 2013.

  1. Onceler

    Onceler Golden Member

    Joined:
    Feb 28, 2008
    Messages:
    1,264
    Likes Received:
    0
    I am writing a program that generates a file, will the EOF marker for Linux be readable on a Windows system and vise versa?
     
  2. EagleKeeper

    EagleKeeper Discussion Club Moderator<br>Elite Member
    Staff Member

    Joined:
    Oct 30, 2000
    Messages:
    42,600
    Likes Received:
    0
    The EOF is a code that both file systems should recognize.

    Now a *nx file may not be directly readable on a windows platform.
    We used to have to send the files across TCP/IP between platforms back in the 90's. Unsure if that issue still exists
     
  3. Ken g6

    Ken g6 Programming Moderator, Elite Member
    Moderator

    Joined:
    Dec 11, 1999
    Messages:
    11,900
    Likes Received:
    74
    If your file is a text file, you may run into the CRLF/LF issue. This can be manually solved with the "unix2dos"/"dos2unix" programs. Otherwise you may want to check for an extra CR (Carriage Return) character in case you need to discard it.
     
  4. Onceler

    Onceler Golden Member

    Joined:
    Feb 28, 2008
    Messages:
    1,264
    Likes Received:
    0
    it will be a binary file the object is to have it readable on both systems without the ctrl-z ctrl-d being a problem.
     
  5. Markbnj

    Markbnj Elite Member <br>Moderator Emeritus
    Moderator

    Joined:
    Sep 16, 2005
    Messages:
    15,687
    Likes Received:
    8
    Sounds like you were curing an endian-ness problem by calling hton* on one side and ntoh* on the other. You were probably using a version of Unix that is big-endian. Windows and most versions of Linux on x86 architectures are all little-endian, so it shouldn't be an issue for most cases now.
     
  6. EagleKeeper

    EagleKeeper Discussion Club Moderator<br>Elite Member
    Staff Member

    Joined:
    Oct 30, 2000
    Messages:
    42,600
    Likes Received:
    0
    One reason why I specified the date - demonstrates aging :oops:
    Very few version of *nx existed at the time on a x86. we had SCO at the timeon a x86.
    The files though were on some mainframe that were being used.

    Would the Mac line have the same issue?
     
  7. Markbnj

    Markbnj Elite Member <br>Moderator Emeritus
    Moderator

    Joined:
    Sep 16, 2005
    Messages:
    15,687
    Likes Received:
    8
    OS X on Intel is also little endian. OS X and earlier systems on power pc and Motorola architectures were big endian.
     
    #7 Markbnj, Feb 19, 2013
    Last edited: Feb 19, 2013
Loading...