#C library for creating .latex pgfplot file with structs

10 messages · Page 1 of 1 (latest)

agile pewter
#

Hello, I'm working on a school project where my assignment is to write a c library that generates a latex pgfplot file with a minimal amount of user input. To keep things simple for now I'm limiting myself to a bar graph. The user would then just have to provide some parameters and the data. My professor suggested using a system of nested structs to store the strings that need to be written into the latex file. Listening to him it all made sense but I don't understand how a c function would be able access the members in the structs without hard coding every member name into the write function. It doesn't look like c has a native way to effectively "loop" through the members of a struct like a object oriented language. I found some possible solutions like function mapping, but it doesn't seem like any of them have the flexibility my professor envisioned.
Any help or ideas would be appreciated. Thanks!

cursive doveBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

agile pewter
#

C library for creating .latex pgfplot file with structs

fleet oyster
#

sounds like a challenging assignment

pastel linden
#

Even if you were able to loop over the fields that likely wouldn't be overly helpful, since you'd likely want to treat fields differently based on the name anyways, and then you'd basically be adding a bunch of if-statements for no real gain over just simply hardcoding

agile pewter
agile pewter
cursive doveBOT
#

@agile pewter Has your question been resolved? If so, type !solved :)

pastel linden