log file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hallosenthil

    log file


    1) i want to know how to create a log file in c++?



    give me example or show me the site link



    2) how to create a 2-d array of characters in a structure where the
    values of the arrays are taken from the external file



    can anyone help me





    thanks in advance


    --
    Posted via http://dbforums.com
  • Bob Smith

    #2
    Re: log file



    hallosenthil wrote:
    [color=blue]
    > 1) i want to know how to create a log file in c++?[/color]

    you could use cerr to stream to any file

    [color=blue]
    >
    >
    >
    > give me example or show me the site link
    >
    >
    >
    > 2) how to create a 2-d array of characters in a structure where the
    > values of the arrays are taken from the external file
    >
    >
    >
    > can anyone help me[/color]

    you could use a vector of vectors.
    /B

    [color=blue]
    >
    >
    >
    >
    >
    > thanks in advance
    >
    >
    > --
    > Posted via http://dbforums.com
    >[/color]

    Comment

    • Mike Wahler

      #3
      Re: log file


      "hallosenth il" <member38057@db forums.com> wrote in message
      news:3478762.10 66127057@dbforu ms.com...[color=blue]
      >
      > 1) i want to know how to create a log file in c++?
      > give me example or show me the site link[/color]

      Example:

      #include <fstream>

      int main()
      {
      std::ofstream logfile("filena me");
      return 0;
      }
      [color=blue]
      > 2) how to create a 2-d array of characters in a structure where the
      > values of the arrays are taken from the external file[/color]

      Example:

      #include <fstream>

      int main()
      {
      struct
      {
      char array[10][10];
      } data = {0};

      std::ifstream external("filen ame");

      if(external)
      external.read(r einterpret_cast <char *>(data.array) ,
      sizeof data.array);

      return 0;
      }


      -Mike


      Comment

      Working...