News for hackers. Stuff that matters.
Re:Internet Archive: Security breach alert by mdaniel on Thursday October 10, 2024 @09:55AM (#41798864)
> I learned that I can't use file i/o in a function outside the main, which is an unspoken rule that no tutorial elucidated.

is for sure not true, that would be crazypants

Re:Internet Archive: Security breach alert by acaiblue44 on Thursday October 10, 2024 @01:16PM (#41801029)
I tried for 6 weeks. Eventually, it just stops functioning. The same program and arguments spits out "segmentation fault" 33% of the time I run it, with the other 67% working perfectly. The only way I could explain it was that it was in a function outside the main, because when I put the exact same code in the main, compiled and ran, it worked.

I have no other explanation. At some point, having too many nested loops and variables causes segmentation faults, whereas less complex code functioned without error. I needed to have certain things performed, and it only functioned in the main.

Re:Internet Archive: Security breach alert by klibertp on Thursday October 10, 2024 @05:42PM (#41803879)
Why would you try to do this in C of all languages? It's one of the worst choices, especially for a self-learner and a beginner like you. Consider: choosing another language could, on its own, 100% eliminate any possibility of getting a segfault! With just that, you'd be spared from having to produce an abomination of many thousands of loc inside a single function, which is never (unless you're Donald Knuth) a good programing practice.
Re:Internet Archive: Security breach alert by numpad0 on Thursday October 10, 2024 @07:50PM (#41804753)
Python is slower but easier, and less likely to segfault out of blue! You don't even have to have a main() loop. If you just have an idea worth demoing quick, I'd recommend switching to Python 3.
Re:Internet Archive: Security breach alert by remix2000 on Thursday October 10, 2024 @01:39PM (#41801244)
It's obviously just skill issue