cstring Questions
2
In my C program, I have a string that I want to process one line at a time, ideally by saving each line into another string, doing what I want with said string, and then repeating. I have no idea h...
3
Solved
There is no file called bits/c++config.h in the c++ include directory which is required by the cstring header file. But when I include the the header cstring and compile with g++, it does not give ...
8
Solved
Can anyone please help me? I need to remove the first character from a char * in C.
For example, char * contents contains a '\n' character as the first character in the array. I need to detect and...
7
I'm using a low level native API where I send an unsafe byte buffer pointer to get a c-string value.
So it gives me
// using byte[255] c_str
string s = new string(Encoding.ASCII.GetChars(c_str))...
7
Solved
What is the best way to convert a C-style string to a C++ std::string? In the past I've done it using stringstreams. Is there a better way?
10
Solved
I have to write my own hash function. If I wanted to just make the simple hash function that maps each letter in the string to a numerical value (i.e. a=1, b=2, c=3, ...), is there a way I can perf...
2
Solved
While playing with Standard C Library functions in Swift, I came across problems
when passing C strings around. As a simple example (just to demonstrate the problem), the Standard C Library functio...
3
Solved
4
Solved
What does the "T" represents in a string. For example _T("Hello").I have seen this in projects where unicode support is needed.What it actually tells the processor
7
I'm trying to encrypt a query string on a game I'm making when opening a url. It doesn't have to be complicated, in fact since I'm working from a game engine it needs to be as simple as possible. I...
Azilian asked 1/10, 2011 at 20:2
7
Solved
I am retrieving the environment variables in win32 using GetEnvironmentStrings(). It returns a char*.
I want to search this string(char pointer) for a specific environmental variable (yes I know ...
5
How to convert CString in MFC to char[] (character array)
Demonstrative asked 24/4, 2009 at 9:38
7
Solved
I have a char array buffer that I am using to store characters that the user will input one by one. My code below works but has a few glitches that I can't figure out:
when I execute a printf to ...
Stephanystephen asked 6/11, 2008 at 23:6
3
Solved
I use this code to read data from sqlite database:
keyFromSql = [NSString stringWithCString:(char *)sqlite3_column_text(preparedStatement, 1)];
but the compiler give me the warning wrote in the ...
Bacteroid asked 24/7, 2010 at 6:49
2
Solved
I have a CString variable that i a need to convert to LPCTSTR(const char*) .I need this conversion so that i can use it as an argument in a function .
The CString look like :
CString sqlTemp = _...
Sadomasochism asked 27/9, 2012 at 11:56
2
Solved
My company use some code like this:
std::string(CT2CA(some_CString)).c_str()
which I believe it converts a Unicode string (whose type is CString)into ANSI encoding, and this string is for a ema...
Upbringing asked 28/11, 2013 at 22:46
3
Solved
The problem comes from an exercise on C++ Primer 5th Edition:
Write a program to assign the elements from a list of char* pointers
to C-style character strings to a vector of strings.
-------...
Harbour asked 23/1, 2015 at 12:59
4
Solved
Most of the time I see constant C-strings defined as:
static char const* MY_CONSTANT = "Hello World";
However, the pointer itself is not const. Wouldn't it be more appropriate to do it like belo...
2
Solved
CString s = "test";
std::string ss = "test";
char z[100];
sprintf(z, "%s", ss.c_str()); // z = "test" : OK
char z2[100];
sprintf(z2, "%s", ss); // z2 = "(null)" : OK. undefined behavior is expect...
Dorr asked 26/2, 2014 at 9:20
1
Solved
2
Solved
I'm struggling to call mktemp in D:
import core.sys.posix.stdlib;
import std.string: toStringz;
auto name = "alpha";
auto tmp = mktemp(name.toStringz);
but I can't figure out how to use it so DM...
Breeding asked 30/11, 2013 at 15:45
5
Solved
Consider the following code.
int main(void) {
char * test = "abcdefghijklmnopqrstuvwxyz";
test[5] = 'x';
printf("%s\n", test);
return EXIT_SUCCESS;
}
In my opinion, this should print abcdex...
2
Solved
I am making a set of derived classes for an assignment. I am instructed to use char arrays (c-strings). When I compile I keep getting the error:
Homework11.cpp: In function âint main()â:
Homework...
2
Solved
From book ATL Internals, I knew BSTR is different from OLECHAR*, and there are CComBSTR and CString for BSTR.
According MSDN Allocating and Releasing Memory for a BSTR, I knew memory management re...
3
Solved
So in attempting to learn how to use C-Strings in C++, I'm running into issues with memory allocation.
The idea here is that a new string is created of the format (s1 + sep + s2)
The text I'm usi...
Damalis asked 2/3, 2013 at 22:8
1 Next >
© 2022 - 2024 — McMap. All rights reserved.