Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8074819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:46:52+00:00 2026-06-05T14:46:52+00:00

I’ve tried a few different ways but it won’t open when it’s saved. How

  • 0

I’ve tried a few different ways but it won’t open when it’s saved. How can I accomplish this?

Basically I want to be able to save an MP4 file that’s currently a resource file to a temp location that I can access as a path.

Here’s something I’ve tried:

    public static void WriteResourceToFile(string resourceName, string fileName)
    {

        using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
        {

            if (s != null)
            {

                byte[] buffer = new byte[s.Length];

                char[] sb = new char[s.Length];

                s.Read(buffer, 0, (int)(s.Length));

                /* convert the byte into ASCII text */

                for (int i = 0; i <= buffer.Length - 1; i++)
                {

                    sb[i] = (char)buffer[i];

                }

                using (StreamWriter sw = new StreamWriter(fileName))
                {

                    sw.Write(sb);

                    sw.Flush();

                }
            }
        }}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:46:55+00:00Added an answer on June 5, 2026 at 2:46 pm

    You’re overcomplicating it.

    Try something like this (note, not compiled or tested, and Stream.CopyTo() only exists in .NET 4.0 and later).

    using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)))
    using (FileStream fs = File.Open("c:\myfile.mp4", FileMode.Create))
    {
        s.CopyTo(fs);
    }
    

    Job done.

    If you don’t have .NET 4.0 available, you’ll need to implement one yourself, like one of these: How do I copy the contents of one stream to another?

    To get a list of all of the resource names in the current assembly, do something like this:

    Assembly a = Assembly.GetExecutingAssembly();
    foreach (string s in a.GetManifestResourceNames())
    {
        Console.WriteLine(s);
    }
    Console.ReadKey();
    

    Take what turns up on the console and pass it into GetManifestResourceStream() in the first snippet I posted.

    http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getmanifestresourcenames.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to construct a data frame in an Rcpp function, but when I
Does anyone know how can I replace this 2 symbol below from the string
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.