|
Mazdak wrote:
sizeof(mypointer)
Change to:
strlen(mypointer)
When you do sizeof of a pointer it returns the size of the pointer, not the length of the string.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
Thanks again Rickard.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
change it to this way.
for(int i = 0 ; *(val+i)!=NULL;i++)
buffer1[i] = *(val+i);
since pointers are always 4 bytes sizeof(anypointer) will always return 4
|
|
|
|
|
Mazdak wrote:
but I don't know how to get size of it dynamiclly.
strlen will give you the size of the string pointed by the pointer.
|
|
|
|
|
Thanks.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
If I understand you, you want to copy the data from a char* to a unsigned char[]?
char* p = "bla bla";
unsigned char uch[WHATEVER_SIZE];
strcpy(reinterpret_cast<char*>(uch), p);
cout << uch << endl;
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
Yah, thats what I want. Thanks.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
Hello,
I have an ".Emf" file on my harddisc,Which I would like to display to screen.
I used the "PlayEnhMetaFile" function for displaying the emf to screen,so far.But It has some problems displaying certain kind of EMF files.
Is there any other way by which I could display the Emf File other than using the "PlayEnhMetaFile" or "PlayMetaFile" functions.
Could any one show it with a piece of sample Code.
Thanks..
|
|
|
|
|
This isn't exactly VC++ but I'm having difficulty with the InstallShield that comes bundled with it so...
At the end of installation, in the "Finished" dialog, I want to give the user the option to display the readme file and launch the program. I know how to add those the text for those options and read the results of the user's selection but how do I actually perform those operations?
In the InstallShield script, how do you display a text file in Notepad and launch the installed software?
|
|
|
|
|
Anybody know how delete operator works over dynamically allocated 2-D array ? How is come to know about the bytes allocated ?
Vikram S
|
|
|
|
|
The memory location is contiguous.
Kuphryn
|
|
|
|
|
Yes, I meant generally arrays are allocated in continous memory locations.The issue is not that. How the delete operator comes to know about "How many bytes to be freed?"
|
|
|
|
|
I would say it deallocates memory until there is a NULL.
Kuphryn
|
|
|
|
|
hey in case of string it's quite okey. But what if i have array of intergers? and NULL =0 ?
|
|
|
|
|
can anyone help me regarding enabling dhcp automatically.
The program should change the network properties to obtain ip address dynamically.
I tried dhcpsvc and iphlpapi but i cant make it to work. anyone???
Thanks in advance.
Conrad
|
|
|
|
|
To enable DHCP:
HKEY hKey;
DWORD dwEnable = 1;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Services\{5AE5DC8F-790F-4DA3-B5EF-492139A60ED7}\Parameters\Tcpip", 0, KEY_WRITE, &hKey);
RegSetValueEx(hKey, "EnableDHCP", 0, REG_DWORD, &dwEnable, sizeof(dwEnable));
const char szTemp[] = "0.0.0.0";
RegSetValueEx(hKey, "IPAddress", 0, REG_MULTI_SZ, (const BYTE *) szTemp, sizeof(szTemp) + 1);
RegSetValueEx(hKey, "SubnetMask", 0, REG_MULTI_SZ, (const BYTE *) szTemp, sizeof(szTemp) + 1); The bold interface will need to be changed accordingly.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thank you very much for the reply, after this how do i restart my network connection in order for the changes in the registry will take effect??
Another big thanks in advance.
|
|
|
|
|
I'm not sure. See if IpReleaseAddress() and IpRenewAddress() do anything useful.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
i have a program use dialog popup to get user info, but if i press ENTER instead of click on the okay button, it just act like i press the CANCEL button. How can i make it work with either click on OK button or press ENTER work the sameway?
|
|
|
|
|
In Dialog editor set Default button style to the OK button.
Robert-Antonio
"A piece of paper is an ink-lined plane.
An inclined plane is slope up.
A slow pup is a lazy dog.
Q.E.D.: A piece of paper is a lazy dog."
|
|
|
|
|
|
I have to call twice memory copy function every 33ms, now I do it with memcpy,but their cpu-cost is too high(two call cost 10ms,about %30 cpu-cost) to run program exactly .So I want to find a method to speed up mem copy .
Happy Gemini
|
|
|
|
|
memcpy is very optimized so there isn't much you can do to speed it up. However, if you ensured the memory was properly aligned, you could write some inline assembly to streamline the copy. At the very least you could measure how long it takes.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
i count the time every copy,it is near 5ms.
Happy Gemini
|
|
|
|
|
w_yufeng wrote:
cost 10ms,about %30 cpu-cost
What is %30 cpu cost? During the copy the cpu usage should be 100%. If it is not then for some reason the copy is being scheduled out of the cpu. Is there any hard disk activity during the copy?
John
|
|
|
|