Hello, dear users of the forum.

I have a question: how to display a list of files in a folder in a string array for further work with it?

In this case, the option is needed cross-platform, so the use of WinAPI and other libraries that work only with certain operating systems is not suitable.

Also, you can not create any files, even temporary, so the System statement also can not apply.

I thought about the possibility of using the preprocessor, but since programming is not so long, I can’t figure out how to use it correctly - ideally I would like to use kernel32 if the program can find it - that is, on Windows, and a third-party library on Linux. Although it is still figured out how the preprocessor is generally connected.

I also considered the option of connecting C files to the project, but so far I have not figured out how to attach Fortran and C files to each other and compile together.

Gentlemen, tell me, please, if you have any idea how this can be implemented.

I work with the Intel compiler 2016, and on Linux there will most likely be gcc.

Thank you in advance for the answers.

  • Using WinAPI will still be under the hood. - Vladimir Martyanov
  • I agree, I just don’t know how to use the preprocessor so that WinAPI would connect normally on Windows, and on Linux the text with WinAPI functions and with the connection of the library itself simply did not compile. Otherwise, just throw out of the program, saying that the library was not found. - Dmitry

0