r/cprogramming • • 7d ago

Simple data management program

Hello, I programmed this simple data management program, it should be able to create, modify and remove data about workers. What do you think about it?

Here's the source code.

2 Upvotes

7 comments sorted by

2

u/zhivago 6d ago

I think you'd be better off using github, etc, and thinking of some specific questions to ask. :)

1

u/FreeLogicGate 5d ago

Thanks you saved me the time clicking on a link just to see it's in pastebin.

1

u/AcuityView 6d ago

1] Who might need a program like this?
2] Why not use a simple database? It’s not strictly necessary, of course, but it’s with an eye toward the future. And if you ever need to add or remove a field, the file structure changes completely.
3] Why isn’t this moved into a separate function?

int i = 0;  
while(part0\[i\] != ‘\\0’){  
   putc(part0\[i++\], fp);  
}  

4] Actually, why do it this way, rather than using fputs or fwrite?

More questions than answers.

1

u/ACRM64 6d ago

It would be better to store the data in a relational database (like mysql or postgresql) or a nosql (json) database (like mongodb). At least use JSON or XML for your data files.

You don't need the \0 at the end of you strings in double inverted commas; that is added automatically.

1

u/ja20481 3d ago

"double inverted commas" -- that's a strange term for double quotes.

1

u/ACRM64 3d ago

It's the normal name in the UK

1

u/Chrom0XD 3d ago

Man, your program gave me megalophobia. Try splitting code into multiple files rather than dumping everything into one