char

What is the simplest way to convert char[] to/from tchar[] in C/C++(ms)?

This seems like a pretty softball question, but I always have a hard time looking up this function because there seem there are so many variations regarding the referencing of char and tchar. ...

How to retrieve n characters from char array

i have a char array in a C app that i have to split into parts of 250 so i can send it along to another application that doesn't accept more at one time, how would i do that ? Platform: win32. Thanks in advance! ...

Caching a const char * as a return type

Hi all.. Was reading up a bit on my C++, and found this article about RTTI (Runtime Type Identification): http://msdn.microsoft.com/en-us/library/70ky2y6k(VS.80).aspx . Well, that's another subject :) - However, I stumbled upon a weird saying in the type_info-class, namely about the ::name-method. It says: "The type_info::name member fu...

Why use boolean instead of char?

Hi, This is a silly question but why does a Boolean take up 4 bytes and a char take up 2 in the .NET framework? It makes me wonder if I should start using chars like a boolean to save memory in large apps. ...

C# char to int

So I have a char in c#: char foo = '2'; Now I want to get the 2 into an int. I find that Convert.ToInt32 returns the actual decimal value of the char and not the number 2. The following will work: int bar = Convert.ToInt32(new string(foo, 1)); int.parse only works on strings as well. Is there no native function in C# to go fro...

Check if Char is in range

Hi, if I have a range of say 000080-0007FF and I want to see if a char containing hex is within that range, how can I do this? Thanks a lot. Example char t = 0xd790; if (t is within range of 000080-0007FF) // true Thanks ...

How to find the length of unsigned char* in C

I have a variable unsigned char* data = MyFunction(); how to find the length of data? ...

Force telnet client into character mode

I have an application where I accept a socket connection from a telnet client and put up a simple, keyboard driven character GUI. The telnet client, at least on Linux, defaults into line-at-a-time mode, so I always have to do ^]mode char manually. A skim of the relevant RFCs suggests that if my application simply sent the characters IA...

string to const char*

This line: strcat(query,*it); (where *it is an iterator to a string) Keeps giving me this error: no matching function for call to \`strcat(char[200], const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' I guess it's because strcat takes in a char* while *it is a string. How do I convert it from a str...

Erasing a Char[]

Okay i am working on someone elses code. They do alot of this: char description[256]; description[0]=0; I know this would put a \0 in the first spot of the character array. But is this even a safe way to erase a string? Also visual studio keeps reporting memory leaks, and i've pretty much tied this done to the strings that are used. ...

C# How to translate virtual keycode to char?

I am trying to map a virtual keycode to a char. My code uses ProcessCmdKey to listen to WM_KEYDOWN which gives me access to the key pressed. For example, when I press single quote I get a key of 222 which I want to have it mapped to keychar 39 which represents... you guessed it... single quote. My dev context is: - .net Framework 2.0 -...

SQLite C/C++ API unsigned char *

Why does the SQLite C/C++ API return unsigned char *s for text values as opposed to the more de-facto char * type? This is somewhat related to the unsigned char question, except that the SQLite API's decision seems opposite of the conventional char * advice given for string-like values. For example: const unsigned char *sqlite3_column...

lptstr to char*

Would anyone hapen to know how to convert a LPTSTR to a char* in c++? Thanks in advance, workinprogress. ...

append an int to char*

How would you append an integer to a char* in c++? ...

Convert std::string to const char* or char*

How can I convert an std::string to a char* or a const char*? ...

sprintf access violation

Hi, I have a problem with the following code: for(i = 0;(i - 1)< n;i++) { char* b; sprintf(b, "%d", i); } It compiles fine but when I run it it give me the infamous "0XC0000005 Access Violation" error. I have tried setting b to NULL, "", "0", 0 and a bunch of other stuff but then I get the "0XC0000005 Access Violation" error or "Expre...

Is a string literal in c++ created in static memory?

Is a string literal in c++ created in static memory and destroyed only when the program exits? ...

NHibernate FK is a CHAR(6), and various queries fail due to the child table PK being CHAR(6)

I have a legacy Oracle database that has multiple 1:n lookup tables that are based on CHAR(6) primary keys in the child tables. Unfortunately, I'm not the only one who has problems with how NHibernate deals with char fields (especially with those as primary keys). See: http://forum.hibernate.org/viewtopic.php?t=984281 http://forum.hibe...

Copy string to pointer to pointer

I am using this example: char *myData[][2] = {{"John", "[email protected]"}, {"Erik", "[email protected]"}, {"Peter","[email protected]"}, {"Rikard","[email protected]"}, {"Anders","[email protected]"}}; char **tableData[6]; tableData[0] = myData[0]; tableData[1] = myData[1]; tableData[2] = myData[2]; tableData[3] = myData[3]; tableData[4] = ...

(C++) Need help with database

I'm trying to make a database and so far, I've been using strings to store my entries from a text file into an array, but this just isn't working out. Thus, I began thinking of a new way of doing it. What I want to do: Lets say I have a text file with the following database... John Smith 00001 jsmith@email pw1 Rob Deniro 00002 ...