|
memcpy is used to copy a specified number of bytes to a destination and not for comparison and strcpy is used to copy a string to another location ie source to destination.
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
sorry... i wrongly mentioned mmcpy and strcpy those should be mmcmp and strcmp...........
can you please re answer my question
vikas da
|
|
|
|
|
strcmp- compare data between two strings. you don't have the advantage of specifying the number of bytes that you want to compare. It's always the complete string that is compared.
tasumisra wrote: mmcmp
It's memcmp by the way
memcmp provides you the flexibility of comparing bytes in the string by mentioning the count
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanks alot ....
one more question
which one should be prefered for
1.Two constant string
2.One const. and one veriable string..
is it strcmp and memcmp respectively for above ..
vikas da
|
|
|
|
|
It depends, whether you want to compare the complete strings or only a few bytes. You should be better off using strcmp in either of the cases if you compare the complete strings
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thank you very much ...
vikas da
|
|
|
|
|
I'm currently using 2-dimensional dynamic array as a function parameter to store value of double. My problem is my program sometimes having a runtime error. I've try a m=3200 x n=58 array size, it only run for a wait before aborting the program. When I reduced the size of the array it works. Here is my declaration of the array:
double* precomp=new double[(_CANVAS_WIDTH /_TILE_WIDTH)*(_CANVAS_HEIGHT /_TILE_HEIGHT)*_TILE_COUNT];
int i,j;
for( i = 0; i < (_CANVAS_WIDTH /_TILE_WIDTH) * (_CANVAS_HEIGHT /_TILE_HEIGHT); i++)
for(j=0; j< _TILE_COUNT;j++)
*(precomp + i* _TILE_COUNT+j) = 0.0;
calculate(TheList, Target, precomp); Here is the function implementation :
void calculate(double* param1, double TargetValue, double* precomp)
{
double _tile;
for (unsigned int y=0; y<list_index;> {
for (unsigned int j=0; j<num_of_tiles;> {
_tile = param1[j];
cout<<"Pre-calculating value for location"<<y<<":tile "<<j<<endl;
*(precomp_fitness + i*num_of_tiles + j) = abs(TargetValue - _tile);
}
}
}
If anyone could help me understand what was happening, it is very appreciated. Thanks.
|
|
|
|
|
You probably cannot get meaningful help because:
- Your scenario + code don't give enough info (you state
m=3200 x n=58 ) but in your code there are just other constants (such as _CANVAS_WIDTH ), that are, for us, of undefined value. - Your code is not properly formatted, see wrong syntax in
for iterations inside calculate function. - Your code gives incomplete info (for instance, how are defined the parameters of the
calculate function? - You don't provide any debug info (for instance what is the offending line?). You are strongly advised using the debugger, that is the king of the programmer's tools
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i want to capture desktop and save image on harddisk on path "c\bit.bmp"
i am using following code
HDC dc_desk=::GetWindowDC(::GetDesktopWindow());
HDC dc=CreateCompatibleDC(dc_desk);
HBITMAP hBmp=CreateCompatibleBitmap(dc, 50, 50);
BitBlt(dc, 0, 0, 50, 50, dc_desk, 0, 0, SRCCOPY);
it is compiling without error
how now we can save this image on harddisk path??
|
|
|
|
|
CImage m;
m.Attach(hbitmap);
m.Save(_T(c:\\1.bmp"));
|
|
|
|
|
but i am using vc++ 6.0
Compiler genrate error on "CImage"
is there need to include any type of hearder or library?? if yes then which one?
|
|
|
|
|
Yeah you need to include AtlImage.h.
|
|
|
|
|
Hi
Help me.
- Use Visual Studio 2005
- As programming language, use C#
Merge SQLite data with HTML template. This action should be done using one 'Merge' button click.
Show merged document in webbrowser.
Save merged document to PDF.
- Merger
Replaces '##[fieldname]##' in the HTML template document with data from the corresponding
column of the SQLite table.
Create one new page in the document for each record in the SQLite table.
Thank you.
Regards,
Och-Erdene
|
|
|
|
|
Please post it to C# forum.
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi all,
I just want to know how to use crypting and decrypting properly, let say i have a key named "securityKey" and the value of that key is "password" how will I able to set that up? and use it at CryptAcquireContext is there anything i need to do first? What I did is just #define securityKey "password" and i feel stupid doing it I am having a hard time understanding this cryptography please help me.
Thanks,
Jayjay
|
|
|
|
|
When a button is clicked,a csv file should be opened
Keerthi
|
|
|
|
|
what about using CFile or CStdioFile to open the text (csv files are text files) file and reading ?
This signature was proudly tested on animals.
|
|
|
|
|
Please Provide more information on what u need to do.
|
|
|
|
|
In MFC VC++ when a button or a list containing csv files is clicked i should be able to view the contents of the corresponding csv file
These are the contents of the csv file
Sam 24 SoftwareEngineer
Raj 22 ProjectEngineer
Thanks
Keerthi
|
|
|
|
|
u can use ShellExecute() function.
|
|
|
|
|
keerthihaasan wrote: i should be able to view the contents of the corresponding csv file
Where would you like to see the contents ? In a edit control, list control, ... ?
Anyway, you have to split the problem in two parts: first is to read the data from the file. For this you can look at std::ifstream. And second part is to display your data. The way you do it is totally dependent on how you want to display it.
So please provide more information (as somebody already suggested).
|
|
|
|
|
Greetings,
I writing a program that will use the text which is within the Windows File Explorer status bar. Is there anyone who knows how this text is achieved? Is there a way to get this text while it is being sent to the status bar? Also, does anyone know how to get this text yourself without accessing the status bar/details section in the left area of the window?
Thanks in advance
"There is no teacher greater than experience." - Some dude from the PC game Jagged Alliance
|
|
|
|
|
How to use staticly allocated data in function calls with ** pointers?
void function(float** a)
{
a[0][0] = 1.0f;
a[1][3] = 2.0f;
}
int main()
{
float b[10][20];
float c[50][30];
float d[4][32];
function(b);
function(c);
function(d);
}
chesnokov
|
|
|
|
|
You can simply cast, i.e. function((float **)b); but then who will inform your function about the array bounds?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
in that case in function(float** a) e.g. a[0][0] start pointing to the wrong address, SEH is invoked.
_msize() tells all the array bounds.
chesnokov
|
|
|
|