Day 74/100 100 Days of code
I created a new Github repo and divided the project into two parts. The first part runs a secondary program and reads the results from a CSV file. Then, the main application simulates these results using SDL. The second program now exists as a submodule in the repository of the first program. Managing each part should be easier now.
I created a new main.c
file to replace the old main.cpp
file and filled it with the necessary code.
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
int main(void)
{
int getCalcFile = system("test -f ../jumpcalculations/app/output/calculations.csv");
printf("%d\n", getCalcFile);
if (getCalcFile == 0)
{
getCalcFile = system("cd ../jumpcalculations/app/output && rm calculations.csv");
if (getCalcFile != 0)
{
printf("Calculations CSV removal failed\n, %d", errno);
exit(EXIT_FAILURE);
}
}
// Execute Simulation
return EXIT_FAILURE;
}
I updated the CMakeLists.txt to create a program using the main.c source file. I should update the CMakeLists with the desired version of C.
cmake_minimum_required(VERSION 3.27)
project("JumpingBall" LANGUAGES C VERSION 0.1 DESCRIPTION "Jumping Ball Physics Simulator")
add_executable(${PROJECT_NAME} ./src/main.c)
I solved two Codewars problems that were quite easy. The first one involved a grade book, and the other required summing the numbers in an array.
Subscribe to my newsletter
Read articles from Chris Douris directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Chris Douris
Chris Douris
AKA Chris, is a software developer from Athens, Greece. He started programming with basic when he was very young. He lost interest in programming during school years but after an unsuccessful career in audio, he decided focus on what he really loves which is technology. He loves working with older languages like C and wants to start programming electronics and microcontrollers because he wants to get into embedded systems programming.