I want to start a new C project that will help me better understand pointers and memory management. I've been using languages like Java and PHP, so I never had to deal with concepts like pointers, manual memory management or anything low level. The only way I could compare pointers in C are references in Java when you create an object of a class, the object is pointing to the memory address of that class, but I'm not even sure if i'm right. So I came up with a project that will help me understand how pointers are used, so came up with this database project.
This is the plan for my database project (basically the description I wrote all down):
"The database (which is basically a text file) will contain the following with the following data type: firstname (char[]), lastname (char[]), id (int), photo (int). For the photo, what you want to do is obtain the binary representation of any image, then store that in the text file along with the other information, as specified below:
firstname//lastname//idnum//photo
fname//lname//12//0110101011001100101...
fname2//lname2//22/010101011011010001101...
Each new information added to the database text file starts a newline towards the end of the binary representation of the image.
users will be prompted to input each information. For the photo part, what you want to do is prompt the user with the option to upload an image file (‘y’ or ‘n’). If user types in ‘y’, open the file directory, check if what the user selects is an image file, and if it is, obtain the binary representation of the image file and store it along with the other information with the format as specified above. Then what you want to do is add another prompt where the user will have to type in their information, then the program will loop through the database text file and obtain the information as specified by the user input and output it to the terminal as shown below:
The binary image will be used for the GUI versionCode:Hello fname lname. You're ID is idnum
Afterwards, you want create a GUI version of the command line version above using GTK, and the GUI will consist of input fields that will allow users to input their information, as well as the button that will allow users to upload an image and obtain the binary representation of that image and store everything on a text file. Then in the GUI, it will also contain an input where users will be asked to input their firstname, lastname and id, then the program will search through the file containing the input information, then output everything, including the image (using the binary representation to output the image) in a grid format, like shown below:
"Code:[photo]: idnum Full name: fname lname
My question is, what instances will I have to use pointers in this database project? BTW, i'm doing this project on Ubuntu.