Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c++ - How to use Memcpy() function -


i want use memcpy in end, instead of

block_orig_left[i1][j1]=block_orig[i1][j1]; pred_orig_left [i1][j1]=block_pred[i1][j1]; 

i have error using memcpy

src/coder.c:909: error: invalid operands binary * (have ‘unsigned int’ , ‘int **’)
src/coder.c:910: error: invalid operands binary * (have ‘unsigned int’ , ‘int **’)

int **block_orig_left=null;  block_orig_left=intmatrix(bsize_y_level[levelv], bsize_x_level[levelv]); pred_orig_left=intmatrix(bsize_y_level[levelv], bsize_x_level[levelv]);  for(i1=0; i1<bsize_y_level[levelv]; i1++) for(j1=0; j1<bsize_x_level[levelv]; j1++) {     block_orig_left[i1][j1]=block_orig[i1][j1];     pred_orig_left[i1][j1]=block_pred[i1][j1];     average_block_orig_left+=block_orig[i1][j1];         }  memcpy(block_orig_left, block_orig, sizeof(int **)*block_orig);  memcpy(pred_orig_left, block_pred,  sizeof(int **)*block_pred); 

how use memcpy correctly?

you multiplying size of int** int**, doesn't make sense. in other words, if wanted know weight of cars on truck, can't multiply "weight of 1 car" "truck". have multiply weight of 1 car number of cars on truck.

the third parameter memcpy number of bytes want copy. correctly getting size of int*, want multiply number of int* in structure. so, if i'm understanding code correctly, want use

sizeof(int**) * bsize_y_level[levelv] * bsize_x_level[levelv] 

since structures copying seem contain many int double pointers.

edit: looking @ david yaw's answer, realize correct. failed address fact inner pointers not allocated @ once, rather in loop or something, need copied in manner. way above copy right amount of memory, not correct memory.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -