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

  • SEARCH
  • Home
  • 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 8628949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:41:02+00:00 2026-06-12T08:41:02+00:00

Im doing this to create the file and save to it: w = new

  • 0

Im doing this to create the file and save to it:

w = new StreamWriter(_outputDir + "\\" + averagesListTextFileDirectory + "\\" + averagesListTextFile + ".txt", false, Encoding.ASCII);
w.WriteLine("DANNY VIDEO META DATA\r\nFORMAT VERSION:1.00\r\nSOURCE: " + "<" + averagesListTextFile + ">" + "\r\nDATA: ");

for (int i = 0; i < averages.Count; i++)
{
    w.WriteLine(averages[i]);
}
w.WriteLine("DATA");
w.Close();

But now i want to save to the file the values from a List wich in each index have another array of values. Like:

[0] 123 33 44 55 66…
[1] 33 44 565 66…

In each index there are 256 values.

I want the text file to look like that after DATA:
The next line will be something like:

Frame Number 1: 123 33 44 55 66
Frame Number 2: 33 44 565 66

So each line will be with 256 values.

This format.

Now the format of the file is like this:

DANNY VIDEO META DATA
FORMAT VERSION:1.00
SOURCE:
DATA:
15.1199916409607
13.7612831147295
13.746730806327
13.2768227559145

Now i want to make that when i read the values from the List the format will be like this:

DANNY VIDEO META DATA
FORMAT VERSION:1.00
SOURCE:
DATA:

Frame Number 1: 123 33 44 55 66
Frame Number 2: 33 44 565 66

The question is how do i read the List that each index contain the 256 values and how do i write it to the text file ?

This is how i tried to do it:

private void WriteHistograms() // For automatic mode only for now
        {
            HistogramsFile = new StreamWriter(_outputDir + "\\" + averagesListTextFileDirectory + "\\"  + "Histograms.txt", false, Encoding.ASCII);
            HistogramsFile.WriteLine("DANNY VIDEO META DATA\r\nFORMAT VERSION:1.00\r\nSOURCE: " + "<" + averagesListTextFile + ">" + "\r\nDATA: ");
            foreach (long[] array in Histograms)
            {
                foreach (long value in array)
                {
                  frameNumber++;
                  HistogramsFile.WriteLine("Frame Number " + frameNumber + " : " + value);                      

                }
            }
            HistogramsFile.WriteLine("DATA");
            HistogramsFile.Close();

The result is a 25MB file size ! And here is example of the text file format:

DANNY VIDEO META DATA
FORMAT VERSION:1.00
SOURCE: <MVI_2483.AVI_Automatic>
DATA: 
Frame Number 1 : 5977
Frame Number 2 : 40775
Frame Number 3 : 174395
Frame Number 4 : 305855
Frame Number 5 : 265805
Frame Number 6 : 212232
Frame Number 7 : 153333
Frame Number 8 : 99743
Frame Number 9 : 62334
Frame Number 10 : 41018
Frame Number 11 : 27381
Frame Number 12 : 21403
Frame Number 13 : 18324

In the end i see Frame Numbers:

Frame Number 973822 : 666
Frame Number 973823 : 1118
Frame Number 973824 : 0

Now sure why the last one is 0 and why 973824 frames while in fact there were about 3800 frames only.

So the file size is logic 25MB ? And format i wanted it to be is like:

Frame Number 1: 33 44 55 66 77 88 ……( 256 values in this line )
Frame Number 2: 22 33 12 3 44 55 …….( 256 values in this line )

And so on.

The List Histograms is type of wich in every index there are 256 indexs in each one a number:

[0] have: [1] 23 [2] 22 [3] 44 and so on
[1] have: [1] 12 [2] 13 [3] 21 and so on

So whats wrong ?

  • 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-12T08:41:03+00:00Added an answer on June 12, 2026 at 8:41 am

    You will need a nested for loop in your original one:

    foreach(long[] array in averages)
    {
    
         foreach(long value in array)
         {
              w.WriteLine(value);
         }
    }
    

    This will allow you to iterate over your List of arrays. In general you would follow this type of loop for most 2 dimensional data structures.

    Edit: If you want to print out each array on a seperate line you will need to modify the loop as follows:

    int frameNumber = 1;
    foreach(long[] array in averages)
    {
         w.WriteLine("Frame Number " + frameNumber + " : ");
         frameNumber++;
    
         foreach(long value in array)
         {
              w.Write(value).Write(' ');
         }
    }
    

    This will produce the following:

    Frame Number 1 : 10 15235 198 65439 24098...
    Frame Number 2 : 10232 135 45619 895649 4598...
    ...
    Frame Number N : 987 651 654 968498 21654...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm doing this project for my OO class. We need to create two
With ASP.net MVC I'm doing this: [HttpPost] [TransactionFilter] public ActionResult Create(User user) { //
In Drupal you can create your own nodetype in a custom module. Doing this
This is what i am doing in coding i want to create controls on
I am using File.Delete(new13.jpg); FileStream stream1 = new FileStream(new13.jpg, FileMode.Create); JpegBitmapEncoder encoder1 = new
I need to create a pdf file with the fpdf library and save it
I have this problem in my application: Step 1 - create an file (xml)
i'm trying to create a page where users can download some .log file. this
I'm following this tutorial CSV-FILE-EXPORT-IMPORT-RAILS but something im doing wrong, because i got an
I want to create a file on the SD-Card and later save a CSV

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.