Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem deals with C++. How do you close an istream pointer or just delete the p

ID: 3748112 • Letter: P

Question

Problem deals with C++.

How do you close an istream pointer or just delete the pointer (near the top of read function).

I'm having file3 overwritten with file3, file2, and file1 contents. file2 is overwritten with file2 and file1 contents. Hence, I'm assuming its something to do with my istream pointer. Here is the compile arguments $ ./hw 90 file1 file2 file3

This is so you can visualize what I'm trying to accomplish

This happens. It's adding the previous file(s) content to the forward file. Its suppose to read from the file, rotate its content by 90 degrees and then write back to that file.

I added "delete in" hoping that would fix it but it came up with all sorts of errors mostly with malloc: *** error for object pointer freed was not allocated and such.

* reads data from text file and pushes it to vector * @param empty 2D vector * @param filename (argv[i] from for-loop) void read (vector& out, string filename) // read from file ifstream textfile; // used for standard input or from file istream in; if (filename.empty)) // read from standard input ./hw 0

Explanation / Answer

If you have any doutbs, please give me comment...

textfile.close();

in->close(); //used in is pointer, so we need to use ->

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote