mtx file

This is a discussion on mtx file within the C++ Programming forums, part of the General Programming Boards category; Hi guys, I have a vector represent a matrix, and now I'm trying to write it into a .mtx file, ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    34

    mtx file

    Hi guys,

    I have a vector represent a matrix, and now I'm trying to write it into a .mtx file, could anyone tell me how to do it?

    Here is an example matrix: <1,4,5,3,2,1,4,5,6>

    Many thanks

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,674
    A for loop perhaps?
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Code:
    std::vector<int>::iterator it;
    for ( it = vec.begin(); it != vec.end(); ++it )
       ofstream << (*it);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  3. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

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