Calculate the size of CString object
-
?? Is this kinda what u mean: CString m = "a"; int size = sizeof(m) + m.GetLength() + 1; //1 for null size will contain '6' bytes... (4 for the internal pointer it maintains, + 1 for the "a", plus 1 for the null byte...) Bikram Singh
-
?? Is this kinda what u mean: CString m = "a"; int size = sizeof(m) + m.GetLength() + 1; //1 for null size will contain '6' bytes... (4 for the internal pointer it maintains, + 1 for the "a", plus 1 for the null byte...) Bikram Singh
CString
s are unicode objects (each character occupied 2 bytes). Also, as I understand it, the size of aCString
object is fixed, regardless of the length of the string, since memory required to store the string is obtained from the heap. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com -
What do you need the size for?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen -
iam making a program like Norton ghost i want to save the files and their paths on another partition as a backup do you have any better idea to make a program like Norton Ghost? do know any function that copy a complete partition into backup disk?
For your purpose, the others said it already, it's
(s.GetLength()+1)*sizeof(TCHAR)
. (however, you cannot simply pass the address of CString itself to a binary reader/writer)
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen -
For your purpose, the others said it already, it's
(s.GetLength()+1)*sizeof(TCHAR)
. (however, you cannot simply pass the address of CString itself to a binary reader/writer)
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygenis there any way or functions that can copy data as a low level binary from the drive to another location or drive (Norton Ghost like) . ex: copy files and directories with out getting the path of each file and copy it to the new location i mean to get binary data from the drive direct and copy it
-
CString
s are unicode objects (each character occupied 2 bytes). Also, as I understand it, the size of aCString
object is fixed, regardless of the length of the string, since memory required to store the string is obtained from the heap. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.comRavi Bhavnani wrote: CStrings are unicode objects (each character occupied 2 bytes). Possibly, but only with the UNICODE directive turned on i should think.. Ravi Bhavnani wrote: Also, as I understand it, the size of a CString object is fixed, regardless of the length of the string True, since CString contains only one pointer data member. But, Abdu's question was a bit vague ("actual size" was unclear to me, so i took a wild guess). Bikram Singh
-
Ravi Bhavnani wrote: CStrings are unicode objects (each character occupied 2 bytes). Possibly, but only with the UNICODE directive turned on i should think.. Ravi Bhavnani wrote: Also, as I understand it, the size of a CString object is fixed, regardless of the length of the string True, since CString contains only one pointer data member. But, Abdu's question was a bit vague ("actual size" was unclear to me, so i took a wild guess). Bikram Singh
bikram singh wrote: Possibly, but only with the UNICODE directive turned on i should think.. Yes, you're quite correct. I was hasty in replying and am also guilty (?) of always supporting Unicode. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com
-
is there any way or functions that can copy data as a low level binary from the drive to another location or drive (Norton Ghost like) . ex: copy files and directories with out getting the path of each file and copy it to the new location i mean to get binary data from the drive direct and copy it
Under WinNT+, you can use CreateFile("\\\\.\\C:") to open read-only access to any disk drive (hdd or fdd), and if you know the FAT/other file system format, you can easily read data using ReadFile(). On Win9x, you can read floppies using VxD services (it's there in MSDN as an example, but i dont remember where). For reading HDD's you need to either use 16-bit code (to call BIOS functions), or write a VxD. Bikram Singh
-
I think what you want to know is how to calculate the size in pixels the string is going to occupy on the screen to do this just find the font's width ( i think there is a function like GetFont you could use to find it ) then multiply the font width by the number of characters in the string