View contents of an array!
Hello,
Sorry for the stupid questions I am asking today!
In the following program, if I put a breakpoint at the following line:
s++; //<<< break point here
How can I view the contaents stored in the following array:
int r[10];
It seems that I can see the contents while on the break point. This is
annoying since I would like to see if the values are actually being written
to this array!
=============================Heres the program!
#include <stdio.h>
//#include <iostream>
//#include <math.h>
//using namespace std;
int w[] = {100,101,102,103,104,105,106,107,108,109}; //Write to file
int r[10]; //={100,101,102,103,104,105,106,107,108,109}; //Read from file
void main(void)
{
FILE *fp;
int x,s;
int Stop;
// Open file for writting
if((fp = fopen("Rougefile", "wb")) == NULL){
printf("Cannot open file. \n");
cin >> x;
exit(1);
}
//Write to file
for(s=0;s<10;s++)
{
if(fwrite(&w[s],1,1, fp) != 1) {
printf("Write error occured. \n");
cin >> x;
exit(1);
}
}
fclose(fp);
//Open file for reading
if((fp = fopen("Rougefile", "rb")) == NULL){
printf("Cannot open file. \n");
cin >> x;
exit(1);
}
//Read from file
for(s=0;s<10;s++)
{
if(fread(&r[s],1,1, fp) != 1) {
printf("Read error occured. \n");
cin >> x;
exit(1);
}
}
s++; //<<<< Breakpoint here!
for(s=0;s<10;s++)
{printf("Here is the file's data > %d", r[s]);}
cin >> x;
//cin >> Stop;
}
=======================================
--
Best regards
Robert