0

Using C++ on Windows XP, Windows 7 and Linux.

Reading the fopen documentation (http://www.cplusplus.com/reference/cstdio/fopen/) about filename:

C string containing the name of the file to be opened. Its value shall follow the file name specifications of the running environment and can include a path (if supported by the system).

What does "running environment" mean in this context? The operating system or file systems?

How do I determine what is supported filename for various platforms (without doing trial and error) ?

LarsA
  • 595
  • 2
  • 6
  • 14
  • Near duplicate: http://stackoverflow.com/q/4814040/179910. As to the "what does it mean part", it mostly means: "Reading cplusplus.com was a mistake. You should have gone to cppreference.com instead." – Jerry Coffin Aug 12 '14 at 13:24
  • 1
    You determine what is a supported filename for a platform by reading the documentation for that platform. – molbdnilo Aug 12 '14 at 13:30

1 Answers1

1

That means that in Windows you need to specify the path using forward slashes while in Linux/Unix backwards slashes(despite of filesystem type).

Windows example filename: C:/some_path/filename

Unix/Linux/Mac example filename: \some_path\filename

Also means that you can't violate the name spacifications for file names, for instance Windows(NTFS, FAT, ...) don't allow the use of ? caracter while Linux does.

Hence, you can say that "running environment" here refers to both, operating system and file system.

Raydel Miranda
  • 13,825
  • 3
  • 38
  • 60
  • 1
    You've got the slashes in your examples reversed. – Harry Johnston Aug 13 '14 at 00:09
  • @Lars Dude, you didn't update your question, yo make an enterely new. That last question has nothing to do with the original. – Raydel Miranda Aug 13 '14 at 12:07
  • Raydel: Sorry, I have seen other people update their original question, just thought that was the norm. Will move update section to another post. – LarsA Aug 13 '14 at 13:20
  • @Lars, It is not personal. People update question when the question isn't very clear or people needs more info about the current problem. But is not fear that someone help us, answer our initial question, and then (even without mark the question as solved) we ask another question. – Raydel Miranda Aug 13 '14 at 13:45