I would like to know how can I write a pointer array:
short* myArray
and a pointer
short[] myArray
to a file in C++?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the ofstream class for this. Open the file with the open() method, then iterate through the array and use the
<<operator to write each short to the file.You can get the size of the array (
short[] array) by doingwhile for the pointer (
short* array) you need to keep track yourself of the size of the array it points to.