DIGIT-ARC read-only archive · snapshot: July 23, 2026

a c progam source code needed

3 posts · originally from https://geek.digit.in/community/threads/a-c-progam-source-code-needed.3773/

S
simplegeek Original post #1
Dec 19, 2004 at 11:39 AM
hi

i am working on a simple home based c project. I am a beginner in this and need a c program which when invoked will give me the names of the files in the directory.

This should be accomplished by giving me the single name of the file as a variable, so i can manupulate or sort them as i want.

just a simple basic code will do.

thanks for ur time
C
Dec 24, 2004 at 11:21 PM
I really cant understand your question.
If you wanted to display all the files in the current directory, you can pass the ls command to a function called system()

Code:
#include<stdio.h>
main()
{
    system("ls");
}

If this is not what you expected, then please reframe your question.
N
Dec 25, 2004 at 4:00 PM
LOL it is better to use ls. Anywasy see source code of ls it will guide you as well as teach you more :D