Thread: Urgent Help!!!

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    2

    Exclamation Urgent Help!!!

    I need immediatly a C++ function that exports a '.mp3' or '.wav' file from a variable.
    The variable is int song[position], where position is a long variable. I promise that whoever gives me the function, will recieve the software that I am currently working(for writing music).

  2. #2
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Read the link in my sig. Once you are enlightened, come back and maybe we can have a conversion.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by Chri5ty
    I need immediatly a C++ function that exports a '.mp3' or '.wav' file from a variable.
    The variable is int song[position], where position is a long variable. I promise that whoever gives me the function, will recieve the software that I am currently working(for writing music).
    int contains about 4 bytes... wav or mp3 can store Megs of info... How do you plan to convert 4 bytes into Megs of data?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    Quote Originally Posted by Chri5ty
    I need immediatly a C++ function that exports a '.mp3' or '.wav' file from a variable.
    The variable is int song[position], where position is a long variable. I promise that whoever gives me the function, will recieve the software that I am currently working(for writing music).
    untested!

    Code:
    #include <stdio.h>
    
    int main(void)
    {
      FILE *fp;
      int song[10] = {0,1,2,3,4,5,6,7,8,9};
      int position  = 4;
    
      char file[128];
    
      sprintf(file, "%d.wav", song[position]);
      fp = fopen(file, "w");
    
      if (fp)
      {
        fputs("I´m only happy when it rains\n"
                 "I´m only happy when it´s complicated\n"
                 "And though I know you can´t appreciate it\n"
                 "I´m only happy when it rains\n", fp);
    
        fclose(fp);
      }
    
      return 0;
    }

  5. #5
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Please do not yell in posts
    Double Helix STL

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Closed for complete lack of netiquette and not reading the forum rules.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. display character size...(quite urgent..)
    By karthi in forum C Programming
    Replies: 10
    Last Post: 07-11-2007, 09:42 PM
  2. beginner plzz help urgent
    By sara101 in forum C Programming
    Replies: 11
    Last Post: 01-14-2007, 10:38 PM
  3. Linked List Need Help Urgent
    By ykchua in forum C Programming
    Replies: 5
    Last Post: 08-17-2004, 02:57 PM