By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,118 Members | 1,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,118 IT Pros & Developers. It's quick & easy.

Accessing elements of 2D array

P: 105
I want to read data file of size 330*330*40 from particular offset value say 330*330*19 and no.of elemnts to read are 330*330.

I have declared a pointer to 2d array as

float *(data)[330];
memset(data,0,330*330) ///allocating buffer with 0
R *ptr=null; /////R is a class where I have t use the read function
ptr->new R(abc.v, false, false); //Initialising constructor and supplying the parameters as given in the class. abc.v is the file I have to read)


where read(const uint64 ,float *const, const uint 64);

first parameter is offset
second one is pointer to buffer for data
third is the no.of elemnts to read.

Now I want to like to print the elemnts that I have read from the data file.So I have written as cout<<*(*(imgdata+100)+10) to access imgdata[100][10] it is not displaying any value at all.

Could anyone please tell me where I am going wrong or any other much better way.Thanks in advance.
Mar 22 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.