EdK | 12 Mar 21:24

corrupted data


I'm trying to use metakit with mingw C++ under windows XP, but my data
seems to be getting curupted. this is my code:

#include "mk4.h"
#include "mk4str.h"

#include <iostream>
#include <string>

const std::string test_table_name("tst");
const std::string ID_field_name("ID");
const std::string result_field_name("result");
const std::string test_number_field_name("testnum");

c4_StringProp pID (ID_field_name.c_str());
c4_DoubleProp pResult (result_field_name.c_str());
c4_LongProp   pTestNum (test_number_field_name.c_str());

int main()
{
    std::cout << "testing MetaKit" << std::endl;

    c4_Storage storage ("testmetakit.dat", true);

    std::cout << storage.Description() << std::endl;

    // Start with an empty view of the proper structure.
    c4_View record = storage.GetAs((test_table_name + "["
            + ID_field_name + ":S,"
            + test_number_field_name + ":L,"
            + result_field_name + " :D]").c_str());

  c4_Row row;

  double result;
  long test_number;
  std::string id;

  std::cout << "enter subject ID :" << std::endl;
  std::cin >> id;
  std::cout << "enter test number :" << std::endl;
  std::cin >> test_number;
  std::cout << "enter test result :" << std::endl;
  std::cin >> result;

  std::cout << "ID : " << id
      << "  test : " << test_number
      << "  result : " << result << std::endl;

  record.Add(pID[id.c_str()] + pTestNum[test_number] +
pResult[result]);

  // This saves the data to file.
  storage.Commit();

    return 0;
}

I know the data is being read properly, because the output before the
record.add has the correct data. but when I open the file with kviewer
the test number and result field do not contain the correct data.

What am I doing wrong?

   -EdK
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "metakit" group.
To post to this group, send email to metakit <at> googlegroups.com
To unsubscribe from this group, send email to metakit-unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/metakit?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane