CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2008
    Posts
    44

    Tab Deliminated output file

    Hi,

    Does anyone know how to create a tab deliminated output file? My data is in a multidimensional array.

    Here is my code, but it doesn't work:

    Code:
    void writeResultMatrix(void)
    {
         cout << "\nWriting result matrix to file .... ";
         
         ofstream f_out;
         f_out.open("myfile.txt", ios::out);
         
         for (int r = 1; r < rows; r++)  //for each row
         {
            //start new line
            f_out << "\n";
            
            for (int c = 1; c < columns; c++)
              {
                   f_out << resultArray[c,r];
                   //tab
                   f_out << "\t";                                  
              }//for
         }//outer for
         
         f_out.close(); 
         cout << "DONE\n";   
    }//void

  2. #2
    Join Date
    Nov 2002
    Location
    Los Angeles, California
    Posts
    3,863

    Re: Tab Deliminated output file

    instead of "\n" and "\t"
    use
    '\n' and '\t'
    Wakeup in the morning and kick the day in the teeth!! Or something like that.

    "i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."

  3. #3
    Join Date
    Jun 2008
    Posts
    44

    Re: Tab Deliminated output file

    Thanks! worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured