Welcome to the ATRC C-CPP Documentation
This documentation provides everything you need to integrate, install, and utilize the ATRC library for your C and C++ projects. Whether you're looking for a detailed installation guide or an exhaustive API reference, you'll find all the necessary information here.
Key Features
- Read and write resource files in C and C++
- Simple and intuitive API
- Lightweight and efficient
- Cross platform support
- Open source and free to use
- Helpful built-in functionalities, such as variable injection, preprocessor directives, and much more
About ATRC
ATRC is a cross platform C and C++ resource file parser that allows you to easily read and write resource files in your projects. It provides a simple and intuitive API that makes it easy to integrate with your existing codebase. ATRC is designed to be lightweight, efficient, and easy to use, making it the perfect choice for developers looking to add resource file support to their applications. Whether you're working on a game, a multimedia application, or any other type of software that requires resource file support, ATRC has you covered. With ATRC, you can quickly and easily load and save resource files, access individual resources, and manage resource data in a way that is both flexible and powerful. ATRC is open source and free to use, so you can start using it in your projects today without any restrictions.
Example resource file
#!ATRC
# DATA.ATRC
%operating_system%=Windows
%version%=10.0
%username%=placeholder
[userdata]
message_1=Hello, %username%!
message_2=Welcome to %operating_system% %version%!
# Injection: 0 = years, 1 = months, 2 = days, 3 = hours, 4 = minutes, 5 = seconds
message_3=Your current uptime is %*2*%.%*1*%.%*0*% %*3*%:%*4*%:%*5*%!
Example program for C++
// MAIN.CPP
#include <iostream>
#include <ATRC.h>
int main() {
atrc::ATRC_FD fd = atrc::ATRC_FD("file.atrc");
if(!fd.CheckStatus()) {
std::cout << "File parsed unsuccesfully!" << std::endl;
return 1;
}
std::cout << fd["var_name"] << std::endl;
if(fd["block_name"]["key"] == "") {
std::cout << "Key not found!" << std::endl;
}
std::string line = fd["block_name"]["key"];
std::vector<std::string> args = {"Hello everyone"};
std::cout << "Before: " << line << std::endl;
std::string res = fd.InsertVar_S(line, args);
std::cout << "After: " << res << std::endl;
return 0;
}
Example program for C
// MAIN.C
#include "ATRC.h"
#include <stdio.h>
int main() {
C_PATRC_FD filedata = Create_Empty_ATRC_FD();
if (filedata == NULL) {
printf("[FAIL] Create_Empty_ATRC_FD: Failed to create ATRC_FD\n");
return 1;
}
if (!Read(filedata, "test.atrc", ATRC_READ_ONLY)) {
printf("[FAIL] Read: Failed to read file 'test.atrc'\n");
Destroy_ATRC_FD(filedata);
return 1;
}
const char* varname = "test_variable";
const char* value = ReadVariable(filedata, varname);
if(value == NULL){
printf("[FAIL] ReadVariable: Failed to read variable '%s'\n", varname);
} else {
printf("[PASS] ReadVariable: Value of '%s' is '%s'\n", varname, value);
}
const char* blockname = "test_block";
if (AddBlock(filedata, blockname)) {
printf("[PASS] AddBlock: Block '%s' added successfully\n", blockname);
} else {
printf("[FAIL] AddBlock: Failed to add block '%s'\n", blockname);
}
if (DoesExistBlock(filedata, blockname)) {
printf("[PASS] DoesExistBlock: Block '%s' exists\n", blockname);
} else {
printf("[FAIL] DoesExistBlock: Block '%s' does not exist\n", blockname);
}
if (RemoveBlock(filedata, blockname)) {
printf("[PASS] RemoveBlock: Block '%s' removed successfully\n", blockname);
} else {
printf("[FAIL] RemoveBlock: Failed to remove block '%s'\n", blockname);
}
Destroy_ATRC_FD(filedata);
return 0;
}