CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: how to access tabulated data created by other programmes?

  1. #1
    Join Date
    Mar 2008

    how to access tabulated data created by other programmes?

    I am a novice in the c++ programming world, and only occasionally do some bit of programming for my students. We prepare marks list in excel or word for our students. The tables will have student name, number, marks in subjects. I want to use the marks from those tables in a c++ programme. I copied the relavant fields as a separate file (though in tabular form, not tables, as I used notepad), and wrote some programmes to read from the file using the file pointer and getc(). That much worked. But if I want to copy the records into some variables, so that I can work on them how should I proceed? Suppose the marks are
    Roll_No Maths History Science
    101 48 44 40
    103 35 40 38
    104 37 39 41

    How can I access them. I know the fields, and the type (int or char). So I can create suitable class. But when I read from the file, using the binary file open, the spaces are also read, or only part of the file is read. why?

  2. #2
    Join Date
    Jun 2006

    Re: how to access tabulated data created by other programmes?

    Hi all.

    You should design a container class that manages a list of record of informations about students (name, subjects, marks and so on).
    This class will have methods such as
    ReadFile, to read the file and create the list.
    Search, to select a specific student.
    Average, to work out the marks average
    You can export data from Excel to text file, where each Excel row is a text row in the file, and the fields are delimited by tab character; so you don't need open the file in binary mode.

  3. #3
    Join Date
    Mar 2008

    Re: how to access tabulated data created by other programmes?

    Thank you, but if I want these values into the class can I use sizeof() and write some code like

    fp.write((char*) class-name[], sizeof(class-name[]);

    or if I redirect the values to


    can I open the second file in binary mode and access the records with read function so that I get the same table back?

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)