-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I am having a hard time in manipulating strings while writing module for linux. My problem is that I have a int Array[10] with different values in it. I need to produce a string to be able send to the buffer in my_read procedure. If my array is {0,1,112,20,4,0,0,0,0,0}
then my output should be:
0:(0)
1:-(1)
2:-------------------------------------------------------------------------------------------------------(112)
3:--------------------(20)
4:----(4)
5:(0)
6:(0)
7:(0)
8:(0)
9:(0)
when…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
memset to initilize data member- What is the benefit of initializing this way? Does it work in this example? Does it work in general ? Is it a good idea in general?
class A {
public:
A();
private:
int a;
float f;
char str[35];
long *lp;
};
A::A()
{
memset(this, 0, sizeof(*this));
…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
When try to do a memset it gives the following exception
"Unhandled exception at 0x1023af7d (PxSmartInterface.dll) in SendOutDllTestExe.exe: 0xC0000005: Access violation writing location 0x40e3a80e."
My memset statement will look like this
memset(lpStatus, 0, csStatus.GetLength());
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I'm involved in one of those challenges where you try to produce the smallest possible binary, so I'm building my program without the C or C++ run-time libraries (RTL). I don't link to the DLL version or the static version. I don't even #include the header files. I have this working fine.
For…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
The manpage says about memset:
#include <string.h>
void *memset(void *s, int c, size_t n)
The memset() function fills the first n bytes of the memory area pointed to by s with the constant byte c.
It is clear that memset can't be used to initialize int array as shown below:
int…
>>> More