Questions tagged [cstring]

Refers to 0-terminated strings as popularized by C, as well as the header-files `string.h` and `cstring`.

A C string is a sequence of non-zero bytes terminated by a NUL byte (0x00), usually used to store ASCII or UTF-8 text.

C strings are defined as char arrays in C and C++, where char is an 8-bit type. C strings can be referred to using a char pointer.

Extensions to the basic C string (e.g. to 16-bit wchar_t "wide strings") also exist in various programming environments.

In C++, the standard std::string class interoperates with C strings via the .c_str() method, though beware that std::strings can contain embedded 0-bytes.

488 questions
1
vote
1 answer

c MD5 from openssl lib does not match php md5 how come?

I am trying to create a md5 hash that I am comparing against a php md5 hash. The two don't seam to be the same below is my c code along with the php compairison Why are the two md5 not the same? Make command gcc -Wall -lssl -o test test.c Code…
MrNemus
  • 299
  • 1
  • 4
  • 13
1
vote
1 answer

NSMutableString to char *

Hot can I convert an NSMutableString to char *? e.g. NSString* someval = @"This is a test."; NSMutableString *temp = [NSMutableSTring stringWithString:someval]; char * temp2 = ????Not sure what to do here???;
Keith Adler
  • 20,880
  • 28
  • 119
  • 189
1
vote
1 answer

Visual C++ is there something like explode for Strings?

I have a CString that I'd like to break up much the way a php explode() would do, I haven't seen anything like this in C++. Does anybody have an easy way to split up a string into substrings given the separator character?
Alan Moore
  • 6,525
  • 6
  • 55
  • 68
1
vote
4 answers

In C, Save one char at a time

I am processing a string in which each word is separated by spaces. The < indicates it is a input redirection, and > indicates it is a output redirection. Ex: < Hello > World I want to save the words in different variables (char *in, char *out…
Dino55
  • 431
  • 3
  • 5
  • 13
1
vote
3 answers

Objective-C - Converting NSString to a C string

Possible Duplicate: objc warning: “discard qualifiers from pointer target type” I'm having a bit of trouble converting an NSString to a C string. const char *input_image = [[[NSBundle mainBundle] pathForResource:@"iphone" ofType:@"png"]…
gotnull
  • 26,454
  • 22
  • 137
  • 203
1
vote
3 answers

search array for string

How would i implement this?Im trying to compare a array of c strings to a single string and if there is no match append it to the 2d array. char*mprt,uni[100][16]; mprt = &uni[0][0]; for (int s = 0;s <= 99;s++) { for (int z =…
Bob the builder
  • 17
  • 1
  • 2
  • 6
1
vote
1 answer

using qsort causing a segmentation fault

Well, as part of learning C++, my project has a restriction on it. I'm not allowed to use any libraries except the basic ones such as and a few other necessities. The project should take in input from a file that is an "n" number of…
Bob
  • 1,219
  • 1
  • 14
  • 28
1
vote
2 answers

How to combine CString, CSimpleMap and CSimpleArray

typedef ATL::CSimpleMap _Map; ATL::CSimpleArray<_Map> g_arrMaps; _Map map; map.Add(WTL::CString(L"first"),WTL::CString(L"second")); map.Add(WTL::CString(L"first2"),WTL::CString(L"second2")); g_arrMaps.Add(map); //another…
lovespring
  • 19,051
  • 42
  • 103
  • 153
1
vote
4 answers

CString Parsing Carriage Returns

Let's say I have a string that has multiple carriage returns in it, i.e: 394968686 100630382 395950966 335666021 I'm still pretty amateur hour with C++, would anyone be willing to show me how you go about: parsing through each "line" in the string ?…
kogh
  • 995
  • 4
  • 17
  • 30
1
vote
1 answer

pointer to an array of pointes of c-style strings c++/cli

I couldn't find a reason for this problem. The function getfruits returns a pointer to an array of pointes of c-style strings. Main tries to access the c-style strings. using namespace System; #pragma managed void getfruits(char ***list, int*…
Anniffer
  • 99
  • 1
  • 6
1
vote
7 answers

escape characters in a CString

How can you put escape characters (like newline character -- \n) to a CString?
lane
1
vote
4 answers

Splitting a char* at its many '\0' chars

The following is in C++. I have a string that contains the environment variables I need to split it at the declaration of each variable & store it in a string: char* envVars = "=::=::\0system=blah\0othervar=blah\0" So I am using cstring functions…
Mack
  • 21
  • 5
1
vote
1 answer

Sending text to static control

I ve got problem here. I want to get info from AVI file and then ask user what he wants to do with it. For this I have dialogbox and there (among other things) I have static text control where I want the info text to appear. The code: BOOL…
Smejki
  • 197
  • 1
  • 2
  • 12
1
vote
1 answer

CEdit Text Retrieval in mfc

I am using CEdit with the property of Multiline.My objective is to retrieve the individual line and place it in my CStringArray. While retrieving the line using GetLine , I have to know the string length of that line. How to get this? I tried the…
karthik
  • 17,453
  • 70
  • 78
  • 122
1
vote
2 answers

Help with Implementation of binary search for names in an array of structs

I need to use a binary search to find a requested name in an array of structs. I used a binary search example code that searched ints and modified it to search through the array indecies to compare the names in each struct. The program runs but the…
darko
  • 2,438
  • 8
  • 42
  • 54