log file

H

hallosenthil

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
 
M

Mike Wahler

hallosenthil said:
1) i want to know how to create a log file in c++?
give me example or show me the site link

Example:

#include <fstream>

int main()
{
std::eek:fstream logfile("filename");
return 0;
}
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

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
 
B

Bob Smith

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

you could use cerr to stream to any file

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

you could use a vector of vectors.
/B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,824
Members
47,369
Latest member
FTMZ

Latest Threads

Top