Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The blue background works correctly in the code you posted here.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The shift is not necessary, should be able to just or the forground and background colors together as you have done without the shift. As for your question, did you try it to see if it works?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Why would I, an unmarried man who is as old as the hills need maternity care? I'm exempt from Obamacare because I already have Medicare and TriCare For Life (US military medical care) which are covered under different laws. But if I didn't have those then I certainly wouldn't need maturnity care, unless of course someone is planning to get men pregnant :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No -- to call a function all you do is use the names of the variables, you do not include the data type like you do in the function prototypes. See how you did it in line 37

OpenInputFile(inFile,infilename);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 39 is a function prototype, not an actual call to the function. You could just as easily move line 39 to line 27 with all the other function prototypes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You'd have to redeclare the function even if you could overload ::, so what's the problem?

class test
{
   public:
       virtual void Created() {cout << "Hello from test class\n";}
       test()
       {
           Created();
       }
};

class Child : public text
{
public:

   virtual void Created() {cout << "Hello from Child\n";}
 };

 int main()
 {
     Child c;
     c.Created();  // call Created in Child class
     c.test::Created(); // call Created in test class
 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Cool :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

remove the typecast -- it's not needed.

Since Text is std::string, why are you calling strlen() instead of using Text.Length()??? Line 5 is completely unnessary, just extra usless baggaged. Line 6 can be rewritten SHORT stringlen=Text.Length();, and you really don't need that either. Just use Text.Length() wherever you have stringlen.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This works

#include <Windows.h>
#include <iostream>
#pragma warning(disable: 4996)

int main()
{
    HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);
    char text[]="Hello World";
    CHAR_INFO *consoletext= new CHAR_INFO[sizeof(text)-1];
    COORD a={sizeof(text)-1,1}, b={0,0};
    SMALL_RECT c={0,0,80,24};

    int i=0;
    for (i=0; i<sizeof(text)-1;i++)
    {
        consoletext[i].Char.AsciiChar  =text[i];
        consoletext[i].Attributes=FOREGROUND_RED|BACKGROUND_RED;
    }

    int success = WriteConsoleOutput(hout,consoletext,a,b,&c);
    if( !success )
    {
        std::cout << "WriteConsoleOutput failed\n";
    }
    delete[] consoletext;
    std::cin.get();
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did you correct lines 11 and 12?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 11 and 12: text is an array of char, not an array of structures, it should be consoletext.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The function is used to write a 2 dimensional array of bytes to the screen, so the second parameter is a 2d array of structures.

Example program is given here. This example reads the text that's on the screen then changes the coordinates so that the text will be written in a different position on the screen. If you want to write all new text you don't have to read from the screen but instead create a new array of structures and fill them in with the text/attribute info

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes, you could do that, but that function is used to change the color of existing text. If you want to write new text in a specific color then call SetTextColor()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to read the remarks for that function:

If the number of attributes to be written to extends beyond the end of the specified row in the console screen buffer, attributes are written to the next row. If the number of attributes to be written to extends beyond the end of the console screen buffer, the attributes are written up to the end of the console screen buffer.

The last parameter to that function is a pointer to a DWORD object that is created in your program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since && and || are the same precedence, technically there is no need for the parentheses. But for human eyes you are right in that the code is more understandable with the parentheses. The two functions should produce the same identical results.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Leap year occurs every 4 years. If the year is evenly divisible by 100 then it is not a leap year, unless it is evenly divisible by 400. For example: the year 2000 was a leap year because it is evenly divisible by 400, but the year 1800 was not a leap year because it is evenly divisible by 100 but not 400. So 1600, 2000 and 2400 are leap years but 1700, 1800, 1900, 2100, 2200 and 2300 are not.

Now, in the function you posted, the && and || operators have the same precedence, so just read from left to right.

rubberman commented: Good explanation AD. :-) +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

CreateFont() or CreateFontIndirect(). You are already calling that in the code you postged in your other thread.

Also -- you shouldn't have two threads for the same question, it just causes confusion. This is my last post in this thread.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

because letters are wider than spaces. Use a fixed-width font and it should work.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Doesn't blink, using VC++ 2012. This version blinks. I marked the lines I changed with //<<<<<<<<<<<<<<

//blinktext.h
#include <process.h>
#include <string>
#include <memory.h>
#include <windows.h>
#include <iostream>

using namespace std;

struct Blink
{
    string Text;
    int x;
    int y;
    int TextColor;
    int BackColor;
};

unsigned __stdcall BlinkLoop(void *params)
{
    Blink *p = static_cast<Blink *>(params);

    size_t tlen = p->Text.length()+1; //<<<<<<<<<<<<<<
    char *EmptyText = new char[tlen];
    memset(EmptyText, 'd', tlen);

    HDC hDC=GetDC(GetConsoleWindow());

    while (true)
    {

        SetBkMode(hDC,TRANSPARENT);
        SetTextColor(hDC,RGB(0,255,0));
        TextOut(hDC,p->x,p->y,p->Text.c_str(),(int)p->Text.length());//<<<<<<<<<<<<<<
        Sleep(500);
        SetTextColor(hDC,RGB(0,0,0));
        SetBkMode(hDC,OPAQUE);
        SetBkColor(hDC,RGB(0,0,0));
        TextOut(hDC,p->x,p->y,EmptyText,(int)p->Text.length());//<<<<<<<<<<<<<<
        Sleep(500);
    }
    return 0;
}

void TextBlink(string text, int x, int y, int TextColor, int BackColor)
{
    Blink *b=new Blink;
    b->Text=text;
    b->BackColor=BackColor;
    b->TextColor=TextColor;
    b->x=x;
    b->y =y;
    _beginthreadex(NULL, 0, BlinkLoop  ,b, 0, NULL);
}



int main()
{
    TextBlink("Hello world", 20,20,3,3);
    cout << "hello world";//like you see, the caret(text cursor) isn't losed


    cin.get();
    return 0;
}
kal_crazy commented: Yup this works as well +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 23: failed to allocate memory for the null string terminator.

Lines 37 and 39: remove +1 from Text.Length().

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

do you know these code?

Read all about it in this MSDN article

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I just ran your program with VC++ 2012 console and it did nothing.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your first mistake was creating a console program -- you should have created a win32 program which uses WinMain() instead of main(). Here is a good tutorial to get you started.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

pragmas are not portable from one compiler to the other. Apparently Code::Blocks knows nothing about that pragma. CB has project settings for that purpose.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

did you include windows.h?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The problem is on line 17 and 20, not with TextOut(). Neither of those two lines are needed, and they are both wrong anyway. The whole function is just too complicated.

unsigned __stdcall BlinkLoop(string Text, int x, int y)
{
    char EmptyText[Text.length()+1];
    memset(EmptyText,' ', sizeof(EmptyText));
    EmptyText[ sizeof(EmptyText)-1) ] ='\0';
    HDC hDC=GetDC(GetForegroundWindow());
    while (true)
    {
        TextOut(hDC,x,y,Text.c_str(),Text.length);
        Sleep(1000);
        TextOut(hDC,y,x,EmptyText,Text.length);
        Sleep(500);
    }
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

scanf_s("%i", &a[*counter]);

scanf() expects the first parameter to be a pointer, so you have to add the pointer operator &.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what is "argument"? It has to be a string literal, can not be the name of a variable. And did you include tchar.h? For edxample

#include <Windows.h>
#include <tchar.h>
#include <iostream>

int _tmain(int argc, _TCHAR* argv[])
{
    std::cout << _T("Hello World\n");
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

windows.h should be sufficient. There are a lot of other macros in tchar.h. My preference is to (almost) never use L because L is not portable between UNICODE and non-UNICODE programs, while the _T() and _TEXT() macros are. If you use _T() you can turn UNICODE on and off without changing the program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can't. Those are macros that work only on string literals -- text within quotes such as "Hello World". You have to call a conversion function to convert char* to wchar_t*. Study the link I gave you.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

_T() is the same as _TEXT(), which converts a string literal to UNICODE, for example _TEXT("Hello World"); Those two macros do nothing for character arrays. These macros are translated at compile time as either wide characters (wchar_t*) or normal ascii characters (char *).

L is not a macro but forces the string literal to be wchar_t*, regardless of whether the program is compiled for UNICODE or not.

LPCWSTR is typedef for a pointer -- same as const wchar_t*, and LPCTSTR is typedef for const char*

Here is a more comprehensive tutorial

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The return value of each of those functions may be incorrect. All they have to do is return res, they don't have to create another object

MixedExpression MixedExpression::add(MixedExpression op)
{
    MixedExpression res;
    res.a = a + op.a;
    res.b = (b * op.c) + (op.b * c);
    res.c = c * op.c;
    return res; // <<<<<<<<<<<<<<<<<<
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The only sport I play regularly is Diablo III. Just got back from the gym where I did some leg and back exercises then spent some time on the tred mill. Does that count as a sport?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

the overall cost of those people should go down

Yes, but whether the cost of health care for already covered individuals will also go down is questionable -- but time will tell. The last time I visited emergency room it cost medicare about $1,800.00 just for me to walk in the doors. I'd be interesting to see what the cost will be a year or so from now after obamacare is fully implemented.

Congress is exempt from Obamacare.

That's not just a claim, it is a fact. It was brought up publically several times during the government shutdown and debate about obamacare.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you've seen the sci-fi movie Independence Day then you would understand why it cost so much money. It's expensive keeping Area 51.

$634M is just a drop in the bucket compared to what it's going to cost for Obamacare.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

She says that the expressways are moving at 5 mph during rush hours.

LOL! If those are "Express" ways, I don't want to see the normal highways.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

They're not the only ones who have such server problems. Diablo III was similar when it was first released over a year ago. Blizzard sold millions of copies before the release date but yet the servers couldn't handle the huge workload. The only way to test a system with millions of users at the same time is to test it live. Just because a program works at the desk doesn't mean it will work anywhere else.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Calling a stored procedure is the same as executing any other sql statement. If you don't know how to do that, then read chapter 13 of this free tutorial

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

i don't like to much of 8, because it's like i need a touchscreen because of it's 'start menu')

Wrong, Windows 8 does not require touch screen. Anything you can do with touch screen you can do just as easily with the mouse.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Line 7 looks like it's trying to put all 350,000 words into a single string?? You might be overloading the number of characters that can be put into a single string (link). Another problem would be memory management, each time a new word is added gto the string vb.net has to increase the size of the string, copy the original string to the new memory location, add the new string to the new memory location then delete the original string. That's a whole lot of work for 350,000 words.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do it in two steps. First step, get return value fromt he stored procedure. Second step: format the select statement that includes the return value of the stored procedure. This means making two calls to the database, which can be somewhat time consuming.

Another option might be to create another stored procedure which does all that. The advantage is there is only one call to the database, not two.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No -- it's impossible to get that precision in operating systems such as MS-Windows and *nix. You need a real-time os such as MS-DOS 6.X in order to do that. I recall reading about some 3d party add-ons to turn MS-Windows into real-time os, but the cost a lot of money.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I just finished installing Pale Moon to see what it's like, I'm using it right now. I had it import all bookmarks and cookies from Chrome. The only problem I see so far is that the LOG OUT button doesn't do anything. All other buttons and menu items work ok.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What compiler and operating system? Have you used your compiler's debugger to single step through the program so that you can see what's happening? You have not provided enough code to enable us to make any knowledgable comments. Attach the entire file(s) to your post so that we can test it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Spicy foods don't prevent cancer. My son has always loved spicy foods such as jalapeno, and now he has cancer. If anything, I would say spicy foods cause cancer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

IMO being the owner of a business sucks. You, and no one else, are responsible for all the good things as well as all the bad things. If you are also an employer then you also have to be head of Personnel, that is you have to hire, fire and be advisor to employees. You can't afford to be too friendly to employees because that can lead top problems elsewhere.

Much easier, IMO, to be an employee; not nearly as stresful.

can anybody be entrepreneur if he is determined and passionate to do something ?

You will never know if you don't try it.

β€œIt is better to try and to fail than to fail to try and forever experience the inestimable loss of what might have been.”

― -Unknown_

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No such site as SeriouslyCoding.com

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here's how to copy files from one computer to another on the same network. Software programs are another thing -- you should just install them on the new computer as mentioned previously by rubberman.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't work any more, but I use a nearby public light rail train (free parking) to travel to the airport which is about an hour's drive away. It's a lot cheaper and easier than driving there then finding a place to park. I could also use it to go downtown St Louis shopping or attend a baseball game. I wouldn't use electronic devices on it for fear of it getting stolen.