For a specific example,consider atoi(const std::string& ).I am very frustrated about this,since we programmers would need to use it so much.
More general question is why does not C++ standard library reimplement the standard C libraries with C++ string,C++ vector or other C++ standard element rather than to preserve the old C standard ...
The following piece of code is causing an exception on a windows vista x64 and i can't figure why.
size_t pBaseAddr;
char *lpszFuncName;
IMAGE_EXPORT_DIRECTORY *pExportDir;
const char **lpszNames;
unsigned int dwIndex;
lpszNames = ((const char **)(pBaseAddr + pExportDir->AddressOfNames));
if(lpszNames == NULL)
return NULL;
for(dwI...
I am trying to do some experiments using different segments besides the default code and data user and kernel segments. I hope to achieve this through use of the local descriptor table and the modify_ldt system call. Through the system call I have created a new entry in LDT which is a segment descriptor with a base address of a global va...
Sorry if this is an obvious question, but I've found surprisingly few references on the web ...
I'm working with an API written in C by one of our business partners and supplied to us as a .so binary file, built on Fedora 11. We've been testing out the API on a Fedora 11 development machine with no problems. However, when I try to li...
Why if I change the size of one of the dimensionality of an array I get a run-time Error: "Segmentation Fault?". Example:
#include <stdio.h>
#define DIM 8
int main(int argc, char **argv)
{
int a[3][3][3][3][3][3][3][3][3][3][DIM],
b;
a[1][1][1][1][1][1][1][1][1][1][1] = 2;
b=a[1][1][1][1][1][1][1][1][1][1][1];
p...
Normally you can print the string in C like this..
printf("No record with name %s found\n", inputString);
But i wanted to make a string out of it, how i can do it? I am looking for something like this..
char *str = ("No record with name %s found\n", inputString);
I hope this has clear what i am looking for...
...
Is it possible to globally disable NUL-terminated strings in GCC?
I am using my own string library, and I have absolutely no need for the final NUL characters as it already stores the proper length internally in a struct.
However, if I wanted to append 10 strings, this would mean that 10 bytes are unnecessarily allocated on the stack. ...
What C-macros is in your opinion is the most useful? I have found the following one, which I use to do vector arithmetics in C:
#define v3_op_v3(x, op, y, z) {z[0]=x[0] op y[0]; \
z[1]=x[1] op y[1]; \
z[2]=x[2] op y[2];}
It works like that:
v3_op_v3(vectorA, +, vectorB, ve...
Hi,
I am struggling to implement an HID control with a Mac : I cannot send the expected function as depicted here below:
IOHIDManagerRegisterDeviceMatchingCallback( gIOHIDManagerRef, Handle_DeviceMatchingCallback, NULL );
with : gIOHIDManagerRef -> the valid HID manager dedicated to this routine
Handle_DeviceMatchingCallback --...
Hi I'm trying to use the name of the executable and an usage string, I'm using argv[0] for such purpose but instead of the name of the executable itself it gives me the complete path to it.
Is there any way to get only the executable name?
...
What would be faster? This:
sprintf(&str[strlen(str)], "Something");
or
strcat(str, "Something");
Is there any performance difference?
...
Hi All,
I am a newbie here. So please bear with me if this is a duplicate/very trivial Qn. I am not from a Computer Science background. But currently working in software testing. I would like move to software development. I know there is whole interesting areas outside there. But I am facing difficulty in choosing where to start? I have...
http://code.google.com/r/hectorchu-go-windows/source/list
If you could compile it successfully, I like to know the procedures of how to.
...
For some reason ncurses does not like stdin, I know I could use instead getstr(), here it is what I'm doing so far,
while (fgets(str, BUF, stdin) != NULL) {
printf("input something ");
}
How could I get an alternative to stdin for this loop (perhaps using getstr())?
Any help will be appreciate it.
Thanks
...
So I have the following program:
int main(){
char* one = "computer";
char two[] = "another";
two[1]='b';
one[1]='b';
return 0;
}
It segfaults on the line "one[1]='b'" which makes sense because the memory that the pointer "one" points to must be in read only memory. However, the question is why doesn't the line "two[1]='b'" s...
I'm writing a driver that communicates with a userland application through a named pipe.
The userland application creates the named pipe by calling CreateNamedPipe() and then passes the pipe name to the driver by invoking an IOCTL. The driver then opens the pipe by calling ZwCreateFile().
The userland application then hits a loop that r...
How to cast from hexadecimal to string in C?
...
Hi I am still new to C. Is there any good implementation of ADT library for C programming language? Implementing Lists, HashMaps, Sets, Stacks, Queues, LinkedLists etc? I know this is kinda stupid question but i wouldn't like to implement all of these just to realize that it's already out there.
I saw shreds of them all over the Interne...
Why is the command line arguments count variable (traditionally "argc") an 'int' instead of an 'unsigned int'? Is there a technical reason for this?
I've always just ignored it when trying rid of all my signed unsigned comparison warnings, but never understood why it is the way that it is.
...
I have a reference of the dll file here:
http://speex.org/docs/api/speex-api-reference/group__Codec.html
What I'm wondering is, in that list, there are a lot of defines. What is the python equivalent, same for the struct class, what are my options for implementing all of this with ctypes? Typedefs?
I'm relatively inexperienced with...