Opening the file

Opening the file with Kotlin/JVM is pretty easy because Java provides APIs to perform CRUD operations on a file. These APIs are not available because Kotlin Native is Kotlin without a VM. Hence, there are only the APIs provided by the standard library, which unfortunately doesn't provide APIs to play with a file. 

This is where we are going to leverage Kotlin Native's feature to enable interoperability with the C code, and use its API to open the CSV file using the fopen function. 

Files can be closed, using the fclose function, by passing the stream (FILE), though all files opened are automatically closed upon normal program termination.

The fopen function opens the file whose name has been passed in the first parameter ...

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.