Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6175775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:58:58+00:00 2026-05-23T23:58:58+00:00

I’m trying to translate the c++ code and i can’t work out what char

  • 0

I’m trying to translate the c++ code and i can’t work out what “char linebuf[1000]” is, can some kind sole translate this to python or explain what linebuf is. Thanks! 🙂 Taken from http://www.scintilla.org/ScintillaUsage.html

if  (ch  ==  '\r'  ||  ch  ==  '\n')  {
     char  linebuf[1000];
     int  curLine  =  GetCurrentLineNumber();
     int  lineLength  =  SendEditor(SCI_LINELENGTH,  curLine);
     //Platform::DebugPrintf("[CR] %d len = %d\n", curLine, lineLength);
     if  (curLine  >  0  &&  lineLength  <=  2)  {
     int  prevLineLength  =  SendEditor(SCI_LINELENGTH,  curLine  -  1);
     if  (prevLineLength  <  sizeof(linebuf))  {
         WORD  buflen  =  sizeof(linebuf);
         memcpy(linebuf,  &buflen,  sizeof(buflen));
         SendEditor(EM_GETLINE,  curLine  -  1,
                    reinterpret_cast<LPARAM>(static_cast<char  *>(linebuf)));
         linebuf[prevLineLength]  =  '\0';
         for  (int  pos  =  0;  linebuf[pos];  pos++)  {
             if  (linebuf[pos]  !=  ' '  &&  linebuf[pos]  !=  '\t')
                 linebuf[pos]  =  '\0';
         }
         SendEditor(EM_REPLACESEL,  0,  reinterpret_cast<LPARAM>(static_cast<char  *>(linebuf)));
     }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:58:58+00:00Added an answer on May 23, 2026 at 11:58 pm

    It is a buffer for a line of input text, of type char[1000], i.e. an array of 1000 char elements (which are actually bytes, because C++ is based upon C, which in turn predates the whole idea of character encodings).

    If we really wanted a literal translation of the algorithm, the closest fit in Python is probably something like array.array('B', [0]*1000). However, this initializes the Python array, whereas the C++ array is uninitialized – there is really no way to skip that initialization in C++; it just reserves space without paying any attention to what’s already in that chunk of memory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.