hello guys,
how to play audio files using c ??
i am just a beginner to c programming and also to this form..
thanks in advance.. :)

with regards,
roshan

See the man page for libsox (assuming it is installed on your system). It provides low-level api's to play sound files. Not simple, but not too difficult. You will need to install the developer package in order to get the header files that you need.

From the libsox man page:

DESCRIPTION
       libsox  is  a  library  of  sound sample file format readers/writers and sound effects processors. It is mainly
       developed for use by SoX but is useful for any sound application.

thanx for the reply guys,
but is there any better way to play the audio without installing any software..

the .NET library but that is pretty much the same as a library they are asking you to install. though installing a library is not the same as installing software. a libray is uncompiled software.

but is there any better way to play the audio without installing any software..

C is a general purpose programming language. It specifies almost nothing about your hardware. C is used to program dishwashers and wristwatches and DVD players and telephones. C does not know what a keyboard is, or a monitor, or colours, or sounds. None of that is required by the C language.

This means that everything like that relies on someone having written extra software to work with your hardware. If you have a sound device on your hardware, someone must write the software for it and that software will not be part of your C compiler. Sometimes, your operating system will provide that software for you, in which case you won't have to install it but you will still have to learn how to use it. Sometimes, you will have to go looking for that software yourself, install it and then learn how to use it.

From time to time, an IDE will come bundled with some additional software to help you do this sort of thing. So, firstly, examine your operating system and see if it provides any functions and libraries for you to generate sound. If not, you will have to find some on the web (as recommended above), download it, install it, and learn how to use it.

C is a very, very general purpose programming language and all that sort of thing is provided by additional software written specifically for your hardware. Long story short - there is no way within the C language definition and you have to work a bit harder for it.

Edit: Awesome. The word wristwátch is censored :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.