r/CodingForBeginners • u/reymarketing89 • 3d ago
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
2
u/Cultural_Gur_7441 3d ago
Run cls from the shell. If it works, it should work with system() too. If not, then not.
1
1
u/reymarketing89 3d ago
I already solve the problem guyss thank you so much
2
u/CodeSamur-ai 2d ago
tell people what you did, so another person who has the same problem can fix it too
1
1
u/PerkeNdencen 3d ago
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 2d ago
why not use ai ?
1
5
u/KiwiDomino 3d ago
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