Connecting Tech Pros Worldwide Forums | Help | Site Map

log file

hallosenthil
Guest
 
Posts: n/a
#1: Jul 19 '05

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
Guest
 
Posts: n/a
#2: Jul 19 '05

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]

Mike Wahler
Guest
 
Posts: n/a
#3: Jul 19 '05

re: log file



"hallosenthil" <member38057@dbforums.com> wrote in message
news:3478762.1066127057@dbforums.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("filename");
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("filename");

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

return 0;
}


-Mike


Closed Thread