Skip to content

C / C++ / MFC

C, Visual C++ and MFC discussions

This category can be followed from the open social web via the handle c-c-mfc@forum.codeproject.com

111.5k Topics 465.7k Posts
  • Mfc

    c++
    3
    0 Votes
    3 Posts
    3 Views
    CPalliniC
    It isn't really specific of MFC. Let's say you have a string s with length L, then you just need to check if (s[i] == s[L-1-i]) evaluates true for every i in the 0, .., (L/2) range. "In testa che avete, Signor di Ceprano?" -- Rigoletto
  • 0 Votes
    21 Posts
    7 Views
    K
    Try using nullptr instead of NULL. NULL is defined as a macro, often the equivalent of #define NULL ((void *)0). That was fine for C, but C++ has stricter rules about converting to/from NULL pointers, so you should use nullptr, particularly when you want to pass a null pointer to a function. Keep Calm and Carry On
  • 0 Votes
    4 Posts
    4 Views
    D
    First, the assignment is incomplete as you tried to post the entire thing in the subject line instead of the body of the post. Second, no, we're not here to do your work for you. Asking for such is insulting. If you've got questions about your your own code, fine, we can help with that, but you have to ask the questions with proper detail to answer them. Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak
  • What MS SDK do you use and why?

    question
    3
    0 Votes
    3 Posts
    3 Views
    C
    My perception as well. Context: so I typically have one development machine for about 4 years. The one I'm typing on is 5+ years old (dang, I need to replace). So what happens over that period of time is that I collect SDKs. I don't pay attention. But I'm trying to position code I need in a "highly secure environment" - which means its elephanting impossible to get any work done, but the IT guy promises to install what I request. Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
  • Linked List Cleanup

    data-structures help
    8
    0 Votes
    8 Posts
    5 Views
    C
    Thanks guys. As you lean stuff, you begin to understand things that you previously heard about but never really understood. I`m taking the std pointers as a new horizon, at this point I feel that they are remote from where I am. I`ll be using the default c++ approach.
  • 0 Votes
    1 Posts
    1 Views
    No one has replied
  • Help with calculating percentage in C

    help question
    7
    0 Votes
    7 Posts
    6 Views
    R
    Hey lookee here ... a joke icon! That's what I needed the other day. Oh well. :thumbsup:
  • working with pointers

    data-structures
    9
    0 Votes
    9 Posts
    6 Views
    C
    It`s just a first time linked list implementation experience, I want to know if I`m not doing foolish things. Quote: There are multiple ways to code I knew there is more than one approach when writing a linked list, but is there `that` many ways to do it?
  • How to pass pointers and process them using ellipsis ?

    tutorial c++ question
    7
    0 Votes
    7 Posts
    4 Views
    K
    It's pretty straight forward, really. When you use the va_arg macro, the second argument is the received objects type. So, to receive a pointer to a type, you use va_arg(args, _Obj_*) where Obj is some object type - e.g. class, int, double, struct, etc. Here's a short working example: #include #include struct S { int data; S(int d) : data(d) {} }; void f(size_t n, ...) { va_list args; va_start(args, n); for(size_t i = 0; i < n; ++i) { S* ptr = va_arg(args, S*); std::cout << ptr->data << '\n'; } } int main() { S item1(1); S item2(2); S item3(3); f(3, &item1, &item2, &item3); } Keep Calm and Carry On
  • 0 Votes
    3 Posts
    3 Views
    F
    or I think I can divide the radius rect.right - rect.lef2 / 2 thank it worked
  • 0 Votes
    22 Posts
    6 Views
    F
    Richard My display is fixed width as it is Courier new I know that exact number of characters in the width of a line (wonder if ShowWindow(SW_HIDE) would drive edit editwordbreakproc) I am just wondering if there is another way and causes line breaks other than 0x0a, 0x0d, 0x0c I have to think about this
  • IPv6 address compression code using vc++

    c++ tutorial
    2
    0 Votes
    2 Posts
    3 Views
    V
    Just write the code following These rules: [Shortening IPv6 Addresses](https://networklessons.com/ipv6/shortening-ipv6-addresses)
  • Getting a specific version of rich edit

    announcement
    3
    0 Votes
    3 Posts
    3 Views
    F
    Hi here is my wordbreak function int CALLBACK EditWordBreakProc(LPTSTR lpszEditText, int ichCurrent, int cchEditText, int code) { char FAR* lpCurrentChar; int nIndex; int nLastAction; switch (code) { case WB\_ISDELIMITER: if (lpszEditText\[ichCurrent\] == 0x0a0d) return TRUE; else return FALSE; break; } } Here is where I invoke it fptrx = &EditWordBreakProc; storagepointer->SendMessage(EM\_SETWORDBREAKPROC, 0,(LPARAM) fptrx); long numstream = storagepointer->StreamIn(SF_TEXT,STORAGESTREAM); variable definition funcptrx fptrx; int CALLBACK EditWordBreakProc(LPTSTR lpszEditText, int ichCurrent, int cchEditText, int code); typedef int (CALLBACK *funcptrx) (LPTSTR, int, int, int);
  • enum { IDD = IDD_DIALOG};

    question
    8
    0 Votes
    8 Posts
    3 Views
    T
    Yup, and this now ties the resource file (with every resource) to the header, so any user of the header had to re-compile, any time any resource element changes, no matter how unrelated....
  • Line Break Rich Edit

    3
    0 Votes
    3 Posts
    3 Views
    F
    I thought rich edit uses BOTH CR / LF as new line seems different versions Of Richedit now to 4.1 have different methods of line breaking trying to figure which rich edit dll/class version I am running
  • 0 Votes
    2 Posts
    2 Views
    Mircea NeacsuM
    No, you cannot. If you need a flexible size structure, the idiomatic solution is to add a zero size array at the end of the structure. Then, presumably, one of the fixed length fields tells you the size of the variable part. Something like this: struct MyStruct { int small_or_big; int variable_part[0]; //or int variable_part[] if you want to conform to C90 }; struct MyStruct *ptr; if (ptr->small_or_big == BIG_STRUCT) { ptr->variable_part[999] = some_value; //we know that variable part size is 1000 //... } When you allocate the structure you have to account for the variable part: //... ptr_small = malloc(sizeof(MyStruct) + SIZE_OF_SMALL_PART); ptr_small->big_or_small = SMALL_STRUCT; ptr_big = malloc (sizeof(MyStruct) + SIZE_OF_BIG_PART); ptr_big->big_or_small = BIG_STRUCT; Mircea
  • 0 Votes
    1 Posts
    2 Views
    No one has replied
  • 0 Votes
    1 Posts
    1 Views
    No one has replied
  • C++ even numbers query

    c++ database tutorial
    9
    0 Votes
    9 Posts
    8 Views
    Richard Andrew x64R
    Is there any doubt? He wants someone to do his work. :laugh: The difficult we do right away... ...the impossible takes slightly longer.
  • C

    tutorial
    4
    0 Votes
    4 Posts
    4 Views
    Greg UtasG
    Prize winner for metaphor density. :-D Robust Services Core | Software Techniques for Lemmings | Articles The fox knows many things, but the hedgehog knows one big thing.