Looking for feedback - C
I've been writing this simple banking program for the past few weeks off and on. Posting for feedback, constructive criticism. Be gentle.
https://gitlab.com/jmgibson1981/basicbanker the libraries i've built for this are here https://gitlab.com/jmgibson1981/mylibraries |
do not use hardcoded full path like this
Quote:
|
What you've called string_return is known as strdup in unix. That's just FYI, I wouldn't suggest using strdup if you're writing portable C, but you might think about the naming differently (focusing on the "return" aspect of it looks a bit funny to me).
Code:
deposit = prompt_scan_f("enter deposit value"); Code:
// open file for reading. if fail to open then create new file Code:
// set up string to search for |
Quote:
I will continue working and exploring. I appreciate the response. *EDIT* Cleaned it up. Think i got the memory leaks, had more than I realized. The libraries are in the same repository as the program now so its in one place. https://gitlab.com/jmgibson1981/basicbanker |
Quote:
|
I don't have to do that for the account number now. I wrote a function to find the highest integer in a given column separated by delimiter. To calc the balance though with the file_search_func as it is I want it to get the first value that matches what it wants. As it writes from top to bottom it needs to start at the "bottom" to get the most recent.
I suppose I can stick the file flip in the file search function and leave it there. Is only place it gets used really. *EDIT* I suppose I could do the same as my highest_integer function and have it parse floats. Then I could drop the flip altogether. Keep the function but no need in this case... It all seems to be working right now save one thing, oddly enough with the append_to_file function. this is the output to the file. I just did the create new account over and over. Code:
1,d,100.00,100.00,aslddjf aldfj Code:
void create_append(FILE * acctinfo, char * name, char * lname, char * deposit) Code:
int highest_integer_column(FILE * file, char * delimiter, int field) |
Solved it. New code.
Code:
void create_new_account(void) // working Code:
int highest_integer_column(FILE * file, char * delimiter, int field) |
All times are GMT -5. The time now is 05:24 PM. |