Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeghi committed Apr 10, 2021
2 parents 8d66a06 + 066a51f commit c29f6b8
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 14 deletions.
16 changes: 16 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64"
}
],
"version": 4
}
10 changes: 10 additions & 0 deletions inc/alumnos.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ bool SerializarAlumno(char * cadena, size_t espacio, const alumno_t alumno);

bool FedericoMeghinasso(char * cadena, size_t espacio);

bool MatiasMeghinasso(char * cadena, size_t espacio);

bool MartinDuarte(char * cadena, size_t espacio);

bool AlejandroPermingeat(char * cadena, size_t espacio);

bool EstebanVolentini(char * cadena, size_t espacio);

bool LucasOrsi(char * cadena, size_t espacio);

/*=====[Prototypes (declarations) of public interrupt functions]=============*/

/*=====[C++ - end]===========================================================*/
Expand Down
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ $(OUT_DIR):

$(BIN_DIR): $(OUT_DIR)
@echo Creating output binaries folder
@mkdir $(BIN_DIR)
# @mkdir $(BIN_DIR)

$(OBJ_DIR): $(OUT_DIR)
@echo Creating output objects folder
@mkdir $(OBJ_DIR)
# @mkdir $(OBJ_DIR)
76 changes: 68 additions & 8 deletions src/alumnos.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Version: 0.1.0
* Creation Date: 2019/06/21
*/

/*=====[Inclusion of own header]=============================================*/

#include "alumnos.h"
Expand All @@ -32,16 +32,17 @@

/*=====[Implementations of interrupt functions]==============================*/

bool SerializarAlumno(char * cadena, size_t espacio, const alumno_t alumno) {
bool SerializarAlumno(char *cadena, size_t espacio, const alumno_t alumno)
{
int resultado;
const char FORMATO[] = "{"
"\"documento\":\"%s\","
"\"apellidos\":\"%s\","
"\"nombres\":\"%s\""
"}";
"\"documento\":\"%s\","
"\"apellidos\":\"%s\","
"\"nombres\":\"%s\""
"}";

resultado = snprintf(cadena, espacio, FORMATO,
alumno->documento, alumno->apellidos, alumno->nombres);
resultado = snprintf(cadena, espacio, FORMATO,
alumno->documento, alumno->apellidos, alumno->nombres);

return (resultado >= 0);
}
Expand All @@ -56,4 +57,63 @@ bool FedericoMeghinasso(char * cadena, size_t espacio) {
return SerializarAlumno(cadena, espacio, &alumno);
}

bool MatiasMeghinasso(char *cadena, size_t espacio)
{
const struct alumno_s alumno = {
.apellidos = "Matias",
.nombres = "Matias Gino",
.documento = "36.806.968",
};

return SerializarAlumno(cadena, espacio, &alumno);
}

bool MartinDuarte(char * cadena, size_t espacio) {
const struct alumno_s alumno = {
.apellidos = "DUARTE",
.nombres = "Martin Nicolás",
.documento = "38.170.436",
};

return SerializarAlumno(cadena, espacio, &alumno);
}

bool AlejandroPermingeat(char * cadena, size_t espacio) {
const struct alumno_s alumno = {
.apellidos = "PERMINGEAT",
.nombres = "Alejandro",
.documento = "00.000.000",
};

return SerializarAlumno(cadena, espacio, &alumno);
}

bool EstebanVolentini(char * cadena, size_t espacio) {
const struct alumno_s alumno = {
.apellidos = "VOLENTINI",
.nombres = "Esteban Daniel",
.documento = "23.517.968",
};

return SerializarAlumno(cadena, espacio, &alumno);
}

bool LucasOrsi(char * cadena, size_t espacio) {
const struct alumno_s alumno = {
.apellidos = "ORSI",
.nombres = "Lucas",
.documento = "38.492.146",
};
return SerializarAlumno(cadena, espacio, &alumno);
}

/*=====[Implementations of private functions]================================*/
bool JosueElias(char * cadena, size_t espacio) {
const struct alumno_s alumno = {
.apellidos = "Velardez",
.nombres = "German",
.documento = "37.165.604",
};
return SerializarAlumno(cadena, espacio, &alumno);
}
/*=====[Implementations of private functions]================================*/
55 changes: 51 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Version: 0.1.0
* Creation Date: 2019/06/21
*/

/*=====[Inclusion of own header]=============================================*/

#include "alumnos.h"
Expand Down Expand Up @@ -34,13 +34,60 @@

/*=====[Implementations of private functions]================================*/



int main(int argc, char *argv[]) {
char cadena[128];

if (FedericoMeghinasso(cadena, sizeof(cadena))) {

if (AlejandroPermingeat(cadena, sizeof(cadena))) {
printf("Alumno: %s\r\n", cadena);
} else {
printf("No se pudo serializar el alumno\r\n");
}

if (AlejandroPermingeat(cadena, sizeof(cadena))) {
printf("Alumno: %s\r\n", cadena);
} else {
printf("No se pudo serializar el alumno\r\n");
}

if (EstebanVolentini(cadena, sizeof(cadena))) {
printf("Alumno: %s\r\n", cadena);
}
else {
printf("No se pudo serializar el alumno\r\n");
}

if (LucasOrsi(cadena, sizeof(cadena))) {
printf("Alumno: %s\r\n", cadena);
} else {
printf("No se pudo serializar el alumno\r\n");
}

if (MartinDuarte(cadena, sizeof(cadena))) {
printf("Alumno: %s\r\n", cadena);
} else {
printf("No se pudo serializar el alumno\r\n");
}

if (MatiasMeghinasso(cadena, sizeof(cadena)))
{
printf("Alumno: %s\r\n", cadena);
}
else
{
printf("No se pudo serializar el alumno\r\n");
}

if (FedericoMeghinasso(cadena, sizeof(cadena)))
{
printf("Alumno: %s\r\n", cadena);
}
else
{
printf("No se pudo serializar el alumno\r\n");
}


return 0;
}
}

0 comments on commit c29f6b8

Please sign in to comment.