Thread: file conversion

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    4

    file conversion

    Hi,
    I want to convert a text file to a excel file using C++. Can anyone help? thnx

  2. #2
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    How? What kind of text file, to what kind of Excel file? Be specific.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  3. #3
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Quote Originally Posted by juju
    Hi,
    I want to convert a text file to a excel file using C++. Can anyone help? thnx
    comvert to what?

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    4
    The text file is a notepad file with the extension .txt and I want to convert this file into an excel one. More specific, the data in the text file should be stored in rows and columns of the excel file.thnx for your time

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    So does your text file contain data separated by commas, spaces or tabs?
    Excel can import this kind of file automatically.
    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.

  6. #6
    Registered User
    Join Date
    May 2006
    Posts
    4
    the data in the excel file is seperated by space. I need to do the conversion by a c++ program not directly from excel.

  7. #7
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    469
    I mentioned something about writing plain text to an Excel file
    here Very straightforward because as Salem said, Excel can
    import plain text.
    No No's:
    fflush (stdin); gets (); void main ();


    Goodies:
    Example of fgets (); The FAQ, C/C++ Reference


    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition


    ASCII stupid question, get a stupid ANSI

  8. #8
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    You might start with the MSDN Office Developer Center

    Take a look at Getting Started With Excel.

    You're probably gong to need Visual Studio and Visual Studio Tools for Office Development.

    And, you're probably going to need a couple of weeks to figure all of that out!

    It would probably be easier with Visual Basic for Applications, than with C++.

  9. #9
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    have a look at this. http://www.wotsit.org/download.asp?f=excel
    it's the file specification format for most versions of excel. You can read in the data from your text file and just export it in this format.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  10. #10
    Registered User
    Join Date
    May 2006
    Posts
    4
    Thank you for your time and ideas

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  2. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  3. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  4. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 10:57 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM