char

Why does MapViewOfFile return an unusable pointer for rapidxml?

As suggested: I have a file which is larger than 2 giga. I am mapping to memory using the following function: char* ptr = (char*) MapViewOfFile( map_handle, FILE_MAP_WRITE | FILE_MAP_READ, 0, 0, 0 ); I parse ptr to rapidxml which accepts Ch* . As per the documentation from rapidxml ptr should be modifiable but since it is decl...

How does char *blah = "hello" work?

When you make a string out of char pointers how does this work? char *name = "ben"; Is this 'hidden' pointer arithmetic? ...

string concatenation with strncat leads to error in signedness

update: the point of whether char, signed char, or unsigned was ultimately moot here. it was more appropriate to use memcpy in this situation, since it works indiscriminately on bytes. Couldn't be a simpler operation, but I seem to be missing a critical step. In the following code, I am attempting to fill bufferdata with buffer for wh...

errors concatenating bytes from a block of bytes using memcpy

On occasion, the following code works, which probably means good concept, but poor execution. Since this crashes depending on where the bits fell, this means I am butchering a step along the way. I am interested in finding an elegant way to fill bufferdata with <=4096 bytes from buffer, but admittedly, this is not it. EDIT: the error ...

mysql Char vs varchar

I know the differnce between CHAR and VARCHAR, CHAR - Fixed length VARCHAR - Variable length (size + 1 byte) But I wanted to know what was the purpse of the having the option for a varchar length e.g. VARCHAR(50), VARCHAR(100), VARCHAR(255) This seems pointless to me because the actual space used depends on the value stored i...

char [1024] vs char *

Hi, I am trying to study C, and I am running in to troubles using char* and char arrays. I am using a generic hash-set container from a library (which I don't want to describe in details). This library includes the function void *HashSetLookup(hashset *h, const void *elemAddr); which I have to use to search in the hash set to see if t...

Reallocate a 2d char array

I have following code int wordLenght = 256, arrayLength = 2, i = 0, counter = 0; char **stringArray = NULL; stringArray = calloc(arrayLength, sizeof(*stringArray)); for(counter; counter<wordLenght; counter++) stringArray[counter] = calloc(wordLenght, sizeof(stringArray)); while(1) { printf("Input: "); fgets(stringAr...

Undefined behaviour (?) in C with char arrays

when i try char bla[32] = "foobar"; int i; putchar(bla[i]); with strlen(bla) < i < 32, bla[i] is always \0. but isn't this in fact undefined behaviour, and should be avoided? ...

char * in managed code?

I have a c++ plus method that generates a value. i am calling this method from a c# application. The C++ method is like this: extern "C" REGISTRATION_API char * generate(char dIn[],char dOut[]) The generate method returns an array of chars (sOut[]=returnvalue; return sOut;) Now I'm calling this method from my c# app: [DllImport("myd...

char vs tinytext

What is the difference between char and tinytext in MySQL? ...

Please explain what this code is doing (someChar - 48)

i'm going through some practice problems, and i saw this code: #include <stdio.h> #include <string.h> int main(void) { char* s = "357"; int sum = 0; int i = 0; for (i = 0; i < strlen(s); i++) { sum += s[i] - 48; } printf("Sum is %d", sum); return 0; } can someone explain what the code does, especially the s...

Convert a string, char type to System.Windows.Forms.Keys

I'm trying to get a char converted to System.windows.Form.Keys type or a string to a Keys array. Does anyone know how to do it in a simple way? ...

Convert Octet string to char array

There is a server which sends some data in Octet strings. For example it is sending 00405080065233E like this, then I need to convert this into a string and store it into a buffer. If I decode that converted string it has give the same 000405080065233E octet string again. How can I do this? Can anybody suggest some solution? ...

Adding two Integers to array index without summing them.

Hi all , I'm a beginner in C# , I'm trying to do this ..... user input "43 24" and the application take this input , put 43 in arr1[0] , and 24 in arr1[1] . The arr1 is char[] type .. i tried this : (This is only a part of the code of course) (wholeLine is type string) foreach (char ch in wholeLine) { if (ch != ' ') ...

public char * member of a class/struct inaccessible?!?!?!po

Code snippet to follow. I have a struct (example code has class, tried both, same effect) that will store a number of char *. I made a constructor for the class that initializes most of them to = ""; Upon attempting to modify that member of an instance of the class, strncpy et all report access denied. These functions even report acce...

Is the char literal '\"' the same as '"' ?(backslash-doublequote vs only-doublequote)

Is there's any difference between char literals '\"' and '"' ? ...

Character Shuffler

Hey Y'all, I was just wondering if there's a way (using ASP.NET C#) to "shuffle" up the contents of a string, but still be able to click another button and "UNshuffle" it back to its original content withOUT saving the original content? Thank you :) Example: "This is not shuffled." "isuo .tffsnl iTh shed" ...And then I click the "U...

How to convert wchar_t** to char**?

I get argv as wchar_t** (see below), because I need to work with unicode, but I need to convert it to char **. How can I do that? int wmain(int argc, wchar_t** argv) { ...

Type casting between char* and UBYTE* (unsigned char*)

Background: I am receiving a array as char* as a part of socket session. Now we have to match the Tokens (HTTP headers) out of it.Code here is that we have created a UBYTE* and getting the value from the char array after typecasting with UBYTE. Later same UBYTE pointer we are passing to other function which accepts char* after typecastin...

copy char* to char*

Here is part of my code: extern "C" REGISTRATION_API int extreme(char* lKey) { string s1; char *p=NULL; try { ifstream myfile ("extreme.txt"); int i=0; if (myfile.is_open()) { while (getline(myfile,s1)) { switch (i) { case 1: strcpy(p,s1.c_str()); lKey=p; bre...