Given a file contains ASCII characters is there anyway to determine the operating system of origin?

This needs to work regardless of the existence of newline characters

  • I am willing to be proven wrong and I'm not confident enough to make this an actual answer, but I would say no. That is kind of the point of cross platform standards. – EBGreen Sep 15 '14 at 15:13
  • No; Its not possible. An program can write a text file like you describe in any number of ways. I could write a program that ran on ANY operating system and the output file would be identical. – Ramhound Sep 15 '14 at 15:14
  • The only thing about the origin if a file I can think of, is 'creation time'. that might be an avenue to look down if at the binary/hex level it's distinctive to an OS, and even after a copy, but I doubt it. don't get your hopes up – barlop Sep 15 '14 at 15:20
  • 1
    Out of curiosity, why does this even matter to you? What problem are you trying to solve by being able to detect this? – Ƭᴇcʜιᴇ007 Sep 15 '14 at 16:13

No Way.

The most would be Windows uses \r\n and unix \n, And even then, you can write a file with *nix line endings in Windows and vice versa. but if no new line characters.. no way.

You can't see the origin of the file, there's no tag of any kind

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.