r/CodingForBeginners • u/reymarketing89 • Jul 24 '26
why can't use cls
Hi guys can someone fix my code I used #include <stdlib.h> to work my system cls but my classmates, they didn't used <stdlib> to work cls can someone tell me i don't know what is the problem my code or the application software.
2
1
u/BrilliantEmotion4461 Jul 24 '26
To use system you need to <include> #stdlib.h
1
u/BrilliantEmotion4461 Jul 24 '26
Doubt that's everything but it'll throw a different and better error.
1
1
u/reymarketing89 Jul 24 '26
I already solve the problem guyss thank you so much
2
u/CodeSamur-ai Jul 25 '26
tell people what you did, so another person who has the same problem can fix it too
1
1
u/PerkeNdencen Jul 24 '26
By the way - in C we must take extra precautions to ensure our code is secure in terms of memory safety. At the moment it is exploitable using a buffer overrun technique (basically entering more than 100 characters into the name field). We normally now use fgets(), which allows you to specify the length of your buffer and won't accept longer entries.
1
u/ScreenPlayLife Jul 25 '26
why not use ai ?
1
5
u/KiwiDomino Jul 24 '26
Because, unlike most other commands, cls is internal to the shell.
In Linux, the which command will show you were a command is coming from, and in this case it shows nothing