> In other words, it means that *pp has those properties wich are mentioned in the structure right
Yea, basically.
> And can only a pointer have that ability to be written in that place
No, you're just declaring a variable. It's the same thing as this:
struct row
{
int *col, size;
};
row *pp;
> What is the difference then when writing a structure, like this
pp is local to main in the first example, but has file scope and external linkage in the second.
> Could you tell me how I can make it redirect towards the output of a file?
If you run the program from the command line you can do this:
C:\> prog > file
C:\> type file
Or you can redirect to a file from directly in within the program. First by using the file stream instead of cout:
#include <fstream>
int main()
{
std::ofstream out("file");
out << "output\n";
}
Or by re-assigning the stream buffer of the file stream to cout:
#include <fstream>
int main()
{
std::ofstream out("file");
std::streambuf *saved_buff = std::cout.rdbuf();
std::cout.rdbuf(out.rdbuf());
std::cout << "output\n";
std::cout.rdbuf(saved_buf);
}
> Well, I guess it depends on what you call simple right
Yea. :mrgreen: Simple for me may not be simple for you, and vice versa depending on the problem. Nobody knows everything.