Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

image text in transcribed

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

image text in transcribed

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 >& out, string filename) ofstream, outfile; outfile.open(filename) for(size ti-; i v; string degrees argv [1]; if(argc 2) read (v, ""); print (v) /I Assume this function works else if (argc > 2) for(int i-2: i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions