C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-21-2009, 12:29 PM   #1
Registered User
 
Join Date: Oct 2009
Posts: 1
Unhappy open audio files

Q. How can I open audio files from the program?
akshaykakar is offline   Reply With Quote
Old 10-21-2009, 12:38 PM   #2
Registered User
 
Join Date: Sep 2006
Posts: 2,504
The fopen() command does that, e.g.:

Code:
FILE *fp;

fp = fopen("myFilename", "rb");

//opens the file myFilename, for reading, in binary mode (instead of text), returning the file's address to the FILE pointer, fp.

if(fp == NULL) { //there was an error, the file didn't open
  printf("\n File open error (myFilename)\n");
   exit(1);      // quit the program
}

//rest of your code.
Adak is online now   Reply With Quote
Old 10-21-2009, 01:11 PM   #3
Epy
I like turtles
 
Join Date: Sep 2009
Location: Ohio
Posts: 179
Check out Wotsit.org for some file format specifications, and say hello to endianness...for instance, .au file data is stored as big-endian, whereas .wav file data is little-endian.

If you're wanting to play the file, you should search for FMOD, BASS, audiere, OpenAL, some library that plays and manipulates sound files.
__________________
Jake, that CAD guy
Hazudra Fodder
Epy is offline   Reply With Quote
Reply

Tags
audio, file, music, program, sound

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Folding@Home Cboard team? jverkoey General Discussions 398 10-11-2005 08:44 AM
Open GL header files Rune Hunter C++ Programming 1 10-03-2005 01:10 AM
Batch file programming year2038bug Tech Board 10 09-05-2005 03:30 PM
Unknown Memory Leak in Init() Function CodeHacker Windows Programming 3 07-09-2004 09:54 AM
open directory and copy files 5n4k3 C++ Programming 3 08-06-2003 09:49 AM


All times are GMT -6. The time now is 11:16 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22