#Problem Programm in C

16 messages · Page 1 of 1 (latest)

edgy dove
#

Hello i have a project in my school is to recode the ls with the [-alRdrt] flags
The problem is that in my ls -a flag i have a problem in my line 20 can someone can help me

prisma condorBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

edgy dove
#

it's in the line while (file = readdir(stream));{

#

it's the C-L1 problem can someone can help me to fix that line please

dim valve
# edgy dove

try ```c
while ((file = readdir(stream)) != NULL)

and don't put the semicolon at the end
wheat zodiac
# edgy dove

oh yeah you have a stray semicolon after the while statement

#

while (file = readdir(stream)) {
should work as intended

#

you could also add the != NULL that Luken suggested, but it works the same way as without (since NULL (0) breaks the loop already)

#

in that case it depends on how you want the code to read

edgy dove
#

I have fixed that

#

this works

#

how can i do for ls -r ?

prisma condorBOT
#

This question is being automatically marked as stale.
If your question has been answered, type !solved.
If your question is not answered feel free to bump the post or re-ask.
Take a look at !howto ask for tips on improving your question.