get input > 1024 chars?

This is a discussion on get input > 1024 chars? within the Windows Programming forums, part of the Platform Specific Boards category; hey, i was wondering how one would go about getting and manipulating a string that was > 1024 chars from ...

  1. #1
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378

    get input > 1024 chars?

    hey, i was wondering how one would go about getting and manipulating a string that was > 1024 chars from the user. i was thinking i could grab the input in sets (from an edit box on a win32 api text editor), do what i want with it, and then save or send it back to the screen. i dont need help getting the input from the edit box, i just need to know how to find out if theres more text to get or if theres a way i can handle all of the text with one bit of code. thanks
    Registered Linux User #380033. Be counted: http://counter.li.org

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Try the Windows forum.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,541
    Good idea - thread moved
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    lol well as of right now i'm not having a problem with it. i have a pointer for the text and then after getting the length, i use malloc to allocate the memory for the amount needed. this is the code i'm using
    Code:
    ...
    TCHAR *buf;
    int len;
    HWND hEdit = GetDlgItem(hwnd, IDC_CHILD_EDIT);
    
    len = GetWindowTextLength(hEdit);
    buf = (TCHAR *)malloc(len + 1);
    ...
    Last edited by willc0de4food; 07-06-2005 at 02:21 AM.
    Registered Linux User #380033. Be counted: http://counter.li.org

  5. #5
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Size of a TCHAR is not always 1 byte.

    So it probably would be safer to do this:

    Code:
    buf = (TCHAR *)malloc( sizeof(TCHAR) * (len + 1) );

  6. #6
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    alright, thanks.
    Registered Linux User #380033. Be counted: http://counter.li.org

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can someone help me with these errors please code included
    By geekrockergal in forum C Programming
    Replies: 7
    Last Post: 02-10-2009, 01:20 PM
  2. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  3. counting lines , chars from an input file need help
    By Mshock in forum C++ Programming
    Replies: 26
    Last Post: 07-12-2006, 11:30 AM
  4. Replies: 11
    Last Post: 03-24-2006, 10:26 AM
  5. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 12:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21