I have a pointer:
char *SomeCharPointer = new char[10];
Lets say I want to write to a file:
CFile SomeFile("C:\\bla.txt", CFile::modeWrite|CFile::modeCreate);
SomeFile.Write(SomeCharPointer, sizeof(SomeCharPointer));
Now, when I do this, I only get the first 4 characters...but when I do this:
SomeFile.Write(SomeCharPointer, strlen(SomeCharPointer));
I get all 10 chars. I'm guessing it's because if this:
Since SomeCharPointer is a pointer, its actual size is 32 bytes (mem location), so therefore, only 4 chars get written (4 chars x 8 bytes a piece = 32 bytes). But when I do strlen(), it returns the actual length...or 10, this is why I get all 10 chars. Is this logic correct, or am I totally off. Thanks in advance!
Niky Williams
NTS Marketing
Niky.Williams@NTSMarketing.com
char *SomeCharPointer = new char[10];
Lets say I want to write to a file:
CFile SomeFile("C:\\bla.txt", CFile::modeWrite|CFile::modeCreate);
SomeFile.Write(SomeCharPointer, sizeof(SomeCharPointer));
Now, when I do this, I only get the first 4 characters...but when I do this:
SomeFile.Write(SomeCharPointer, strlen(SomeCharPointer));
I get all 10 chars. I'm guessing it's because if this:
Since SomeCharPointer is a pointer, its actual size is 32 bytes (mem location), so therefore, only 4 chars get written (4 chars x 8 bytes a piece = 32 bytes). But when I do strlen(), it returns the actual length...or 10, this is why I get all 10 chars. Is this logic correct, or am I totally off. Thanks in advance!
Niky Williams
NTS Marketing
Niky.Williams@NTSMarketing.com