How can I get a string that is between two other declared strings, for example:
String 1 = "[STRING1]"
String 2 = "[STRING2]"
Source: "832h0ufhu0sdf4[STRING1]I need this text here[STRING2]afyh0fhdfosdfndsf"
How can I get the "I need this text here" using C++.
...
I'm building a series of predicates that duplicate lots of code, and so are being changed into a single template function class based on the std::unary_function. The idea is that my class interface requires methods such as Element_t Element() and std::string Name() to be defined, so the predicate template arguments are the object type an...
Possible Duplicate:
Why pure virtual function is initialized by 0?
In C++, what does it mean to set a function declaration to zero? I'm guessing it has to do with the function being virtual, and not actually defined in this class. Found in a header file of code that I'm reading:
virtual void SetValue(double val)=0;
What's...
I would like to create a static (file scope) table of data pointer, data size and data version. The problem is that the data are in external files, but constants in the extern files.
Example:
file1.c
const unsigned char data1[] =
{
0x65, 0xF0, 0xA8, 0x5F, 0x5F,
0x5F, 0x5F, 0x31, 0x32, 0x2E,
0x31, 0xF1, 0x63, 0x4...
I have the following code:
typedef __int64 BIG_INT;
typedef double CUT_TYPE;
#define CUT_IT(amount, percent) (amount * percent)
void main()
{
CUT_TYPE cut_percent = 1;
BIG_INT bintOriginal = 0x1FFFFFFFFFFFFFF;
BIG_INT bintAfter = CUT_IT(bintOriginal, cut_percent);
}
bintAfter's value after the calculation is 14411518807...
I am wondering if it is possible to have werror in gcc/g++ exclude certain files (ones that I do not have source code to modify) so that I can continue using werror in a uninhibited state.
...
I've simple class method like
Task TaskSample::Create(void)
{
Task task;
return task;
}
and got warning taking address of temporary. Is something wrong with this code ?
I prefer to not use pointer here
...
Is this illegal/dangerous?
int* static_nonew()
{
static int n = 5;
return &n;
}
The compiler doesn't seem to have a problem with it, but is the pointer location itself protected from being overwritten when someone else needs memory?
EDIT: A little bit more of an explanation of why I asked this question. Note: I'm programming ...
There's a resource manager class. It helps us to access devices. But, of course, it should look for not to give access to one device for 2 processes at the same time.
At first I thought I wouldn't have any access queue. I thought there would be method like anyFree_devicename() that would return access handle if there is any free and NUL...
Hi,
well, as so often title says it all. Here's my attempt (ugly GDI+ and GDI mix...)
// ...
BYTE pixels[BMP_WIDTH * BMP_HEIGHT * BMP_BPP];
HBITMAP hBitmap;
Gdiplus::Bitmap cBitmap(BMP_WIDTH, BMP_HEIGHT, PixelFormat32bppRGB);
Gdiplus::Graphics cGraphics(&cBitmap);
Gdiplus::Pen cPen(Gdiplus::Color(255,...
I am trying to wrap an unmanaged c++ interface composed of several abstract structs (with all pure virtual methods) and a small factory namespace which returns handles (shared_ptrs) to these structs.
It seems that, because of this, I might be able to get away with merely marshalling pointers through as System.IntPtr types (although them...
I am trying to download and build the 'WIC Image Viewer usign Direct2D' from here, but when I build my solution, I am slapped with 56 errors that look like:
Error 1 error LNK2019: unresolved external symbol _imp_CoUninitialize@0 referenced in function _wWinMain@16 WICViewerD2D.obj
Error 2 error LNK2019: unresolved external ...
Hey everyone,
I am having an issue in my recv() loop for winsock. I am trying to terminate the loop when iResult==0, however, the loop only ends when the socket closes. It appears to be hanging at the very last recv() where iResult would equal 0. So any ideas on how to terminate the loop effectively? My ultimate goal (whether iResult ==...
hello
I am not able to get this to work:
template<class Input, class Output, class Index>
size_t pack(void (*copy)(Input, Input, Output),
size_t N, Input input, Output output,
const Index &index);
size_t K = pack(&std::copy<const double*,double*>,
M, C.data().begin(), C_.data().begin(),
...
So I'm far from an expert on C, but something's been bugging me about code I've been reading for a long time: can someone explain to me why C(++) programmers use typedefs to rename simple types? I understand why you would use them for structs, but what exactly is the reason for declarations I see like
typedef unsigned char uch;
typedef ...
Possible Duplicate:
When to use std::size_t?
hello.
Assuming usage patterns are the same (i.e. no negative numbers), which is preferable to use for various indexes, int or size_t type?
Is there performance difference in your experience on 64-bit Intel between the two?
Thank you
...
Hi all,
I want to launch a application using win32 ...
Plase let me know your ideas to achive the same
...
I'm working on opengl project.
I set up perspective projection and render a transformed rectangle (rotated, scaled)
How i can calculate rectangle's bounding box (rectangle position,size)
Thank you
...
I know about external linkage using the keyword
extern "C"
EX :
extern "C" { template<class T> class X { }; }
but they gave template shall not have a C linkage
can any one explain this ?
...
I am trying to print a value of an array element as cout << array[0], (where the array is some glorified class using operator[]), but the C++ typing system seems incredibly confusing. The GCC error is this:
example.cpp:44:20: error: no match for ‘operator<<’ in ‘std::cout << a_0.fixedarr<T, N>::operator[] [with T = int, long unsigned in...