Parsing Files in C

What is the best way of parsing files within Blender? (in c code)
Is there any proper way ?

That is gonna be highly depended on the type of file you are parsing, parsing some binary file, vs parsing xml or json is going to get you wildly different answers. There is no single ‘right way’ for all possible formats.

Binary files are going to be deserialized. I am looking for a method of parsing text files like objs for example.

parsing of .obj is done in python in blender, you can find the code in release\scripts\addons\io_scene_obj\import_obj.py

I know where to find it :man_facepalming:
My question was how to parse some data in Blender using C, so that I can use that data to initialize my own IDType.

given we parse most io (obj/fbx etc) formats in python, and most binary formats using their preferred libraries (png/jpg etc) there isn’t really any support code for parsing arbitrary data, so you’re on your own here.

if you want to parse a file in C, there isn’t much to say thats Blender spesific.

Besides some of the data structures we have for memory pools, hashing unique data… etc, this is basically the same as parsing a file in any other C code.