Kathick
Kathick

Reputation: 1405

Resources file management in c++

I am new to c++ i am from JAVA.

How the resource files are managed in c++?

In java we use a separate source folder "resources" and use the same package name.

src
 com.example.test
   Example.java
resources
 com.example.test
   config.xml

and we can get the config.xml in Example.java using getClass().getResource("config.png"));

How can do the same or what is the way to achieve this situation.

Upvotes: 1

Views: 258

Answers (2)

steve9164
steve9164

Reputation: 466

You could use a single resource file to store all the resources you need for the project together. Here is a good template that you could either use as is or change to suit your needs. I have personally used a modified version of this for one of my own recent projects. For C++, you could update the library calls to use C++ STL, or just use the C library. Also another template here.

Upvotes: 0

spiritwolfform
spiritwolfform

Reputation: 2293

C++ doesn't support resources. But you can use some framework to achieve similar functionality. Use Qt, for example: Qt resource system

Upvotes: 1

Related Questions