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

On line 14 use && (and) operator instead || (or) operator. You want to find out if str is not equal to str1 AND if it is not equal to str2.

But strcmp() does a case sensitive comparison, meaning that Yes is not the same as yes or yEs or yeS. You should use a case insensitive comparison. One such function is stricmp(), which may not be available on all compilers. Another way to do that is to convert the entire string to either upper or lower case, depending on the string that you want to compare it with. To do that just loop through the string and call toupper() or tolower() for each character.

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

Yes, we all do. The error message already told you to call strcmp() to compare two strings.

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

If NewButton2 is referenced in NewButton1.h then NewButton2.h must be included in NewButton1.h Your problem sounds like you just need to get the includes in the correct order.

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

You need to use the UPDATE SQL statement, not the INSERT statement.

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

Depends. Offhand I'd say it will require 100% rewrite because java doesn't have access to .net framework. But good news -- here is a bridge between the two

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

line 13: remove pos+1

line 20: add pos+1 in the substr

The two lines mentioned above are conflicting with each other.

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

Is the problem with certain browsers? I use Chrome and Windows 7 now and I have no problems like that at all.

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

I haven't experienced the problem tonight but maybe I'm just lucky tonight :)

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

>> for int main() why do we always have to write return 0?
Its optional in c++ but not in C. The reason is because the c++ standards say its optional. If you don't specify a return value then return 0 is assumed.

MS-Windows and *nix operating systems do nothing with the return value except pass it along to a program that may have caused the program to be executed. return value of 0 is traditionally means the program executed everything successfully. Any other return value means nothing to the os, but traditionally means an error of some sort and the exact error is up to the calling program to determine.

Regardless of the return value the operating system will clean up everything when the program terminates.

>>also can someone explain when i use unsigned variables?? I never use them unless a function on MSDN requires it.. so is there any use of them other than passing them to functions as parameters

Yes -- I use them as loop counters and other occasions when negative numbers are not needed. I believe that gives the compiler to better optimize the code.

The reason for constants is to let the compiler know that the variable will never be changed, so that the compiler can optimize the code better. In some cases the compiler may be able to discard the const altogether.

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

That question has been asked and answered several times -- see one of these threads

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

scanf() expects the prameters to be pointers so that it can change the variables values. num is just an integer, not a pointer, so put the & pointer operator in front of it. count = scanf ( "%s%n", phone, &num ); Also see this article about %n.

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

What do you mean by "title"? Column names? Binary files don't have columns.

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

Well, that's the way binary files work. The files contain non-printable characters so you can not treat them as if they are plain text files. You can not view binary files with a text editor such as Notepad. If you want to do that then you will have to change the way the file is written by calling fprintf() to write out each of the fields in the structure individually, such as fprintf(fp,"%s\n", newcous->str1);

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

How is the TextBox object declared? Are you trying to use the same instance over and over because that won't work even if the compiler didn't complain.

I got this to work ok. The code I added is marked in Red

#pragma once
#include <cliext\vector>

namespace TestFormks {
	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}
    private: System::Windows::Forms::TextBox^  textBox1;
    public: 
    private: System::Windows::Forms::TextBox^  textBox2;

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}

	private:
        cliext::vector<TextBox^> txt_box;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
            this->textBox1 = (gcnew System::Windows::Forms::TextBox());
            this->textBox2 = (gcnew System::Windows::Forms::TextBox());
            this->SuspendLayout();
            this->txt_box.push_back(textBox1);
            // 
            // textBox1
            // 
            this->textBox1->Location = System::Drawing::Point(91, 50);
            this->textBox1->Name = L"textBox1";
            this->textBox1->Size = System::Drawing::Size(100, 22);
            this->textBox1->TabIndex = 0;
            // 
            // textBox2
            // 
            this->textBox2->Location = System::Drawing::Point(91, 97);
            this->textBox2->Name = L"textBox2";
            this->textBox2->Size = System::Drawing::Size(100, 22);
            this->textBox2->TabIndex = 1;
            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(282, 255);
            this->Controls->Add(this->textBox2);
            this->Controls->Add(this->textBox1);
            this->Name = L"Form1";
            this->Text = L"Form1";
            this->ResumeLayout(false);
            this->PerformLayout();

        }
#pragma endregion
	};
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 32: fopen() flag is wrong. Use "a+b" instead of "wb". See this link for details.

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

What do you mean "it does not work"? Would you take your car to a repair shop and tell the mechanic the same thing? I hope not.

Is that CLR/C++ code (e.g. Windows Forms) you posted? If so, you can not use the standard templates like you would in c++. Instead, use the files in include\clrext folder.

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

Yup, Microsoft has phased out debug.exe because Windows 7 no longer supports those ancient 16-bit programs.

You can download DosBox and run the 16-bit programs and debug.exe from there.

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

First, don't use exit().

You need to add a loop to your program so that if you answer 'Y' then the program will just loop back to the beginning and start all over again

void addCustomer()
{
   char answer;
   do // beginning of loop
   {
      // put your code here

      printf("Add another record (Y/N)?\n");
      answer = getchar();

   } while( answer == 'Y'); // end of loop
   return 0; // exit program
}

You could also do it from main() and change addCustomer() to return the value of the answer from addCustomer().

char addCustomer()
{
   printf("Add another record (Y/N)?");
   return getchar();
}

int main()
{
  while( addCustomer() == 'Y')
       ; // just stay in this loop
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I got mine soon after it was legal for me to do so -- 16. That was waaaay back in 1959, and I flunked it the first time because I went through a stop sign while the cop was sitting in the passenger seat next to me. I guess I was just so nervous that I didn't even see the sign. As for actually driving, any farmer kid will tell you that they learn to drive at a very early age. I was probably about 12 when I started to drive tractors.

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

Than I guess you won't mind if I post a link to www.fuckfrance.com or the brainfuck programming language.

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

Niger state Nigeria, Misty and dull.

I'm going to stop posting at DaniWeb until this offensive post gets deleted. Bye.

pseudorandom21 commented: Why surely do you jest my good sir! lulz +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think the file is so big and when I'm trying to access it, it's not in the HD yet.

You might have to call ostream's flush() method to force the os to write the data to the file.

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

Which post? I'm not going to search all 78 of your posts to find out why someone voted you down.

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

You're going to need a 64-bit version of the file i/o functions. For MS-Windows you can use ReadFile() win32 api function. Don't know about *nix. I know ReadFile() isn't as convenient as fstreams, but AFAIK the only way to get 64-bit version of fstream is to use a 64-bit compiler. ReadFile() give you 64-bit options.

You would probably be better off using one of boost's file i/o functions. I'm not familiar enough with it to give you more information, you just need to read the documentation at the link I gave you.

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

The statements starting on line 46 are not constructed correctly. if( category == 'T' || category == 't') You don't want to call getchar() inside each of those if statements. Its already called on line 45 so all you have to do is use the value of category.

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

Here in midwest USA its very hot -- 7 straight days of +100 temps and no rain. Pretty typical for this time of year.

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

Since you are using CLR/C++ (managed code) instead of just c++ you should be calling System.IO.FileSystemInfo's GetAttributes instead of the win32 api function GetFileAttributesEx().

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

I would like to see Dani apply those same rules over on PFO. There currently are no rules against sig only spamming, so many of them are not deleted, although I must admit to deleting them anyway in some cases. For example I'll delete "nice post, thanks for sharing" type posts even though there are no rules forbidding it.

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

If I wanted a lecture in jihad appeasement from the politically correct, I would have requested one. I'm not interested in discussing the issues. Maybe one of the members has the guts to offer up something on the requested subject.

Your the one who started this crappy thread, so don't complain when someone posts something you don't like. But I would agree this thread should be closed to agoing religious flame war.

happygeek commented: nicely put AD +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And note you have to include windows.h in order to use Sleep()

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

Compile and run the program I posted but remove the virtual keyword everywhere. It will show you the difference between using virtual and not using virtual.

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

Here is one explanation. And here is another

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

You mean something like this? If you run this program you will see that class A is common to all the other classes. There are not separate instances of class A in class B, C and E. Any changes to the data in class A is reflected in all other classes because of the virtual keyword.

#include <iostream>
using std::cout;

class A
{
public:
    A() {x = 0;}
    void show() {cout << "x = " << x << '\n';}
protected:
    int x;
};

class B :virtual public A
{
public:
    B() {y = 0; A::x = 2;}
    void show() {cout << "y = " << y << '\n'; A::show();}
protected: 
    int y ;
};

class C :virtual public A
{
public:
    C() {z = 0; A::x = 3;}
    void show() {cout << "z = " << z << '\n'; A::show();}
protected: 
    int z ;
};
class E : virtual public B,virtual public C, virtual public A
{
public:
    E() { A::x = 4; B::y = 2;}
    void show()
    {
        B::show();
        C::show();
        A::show();
    }
};

int main()
{
    E e;
    e.show();    
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Hit the "Flag Bad Post" button and ask a moderator to move it for you.

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

If that is all it is doing

double* foo(couble d1,double d2,double d3,double d4,double d5,double d6)
{
    double* d = malloc(5 * sizeof(double));
    d[0] = d1;
    d[1] = d2;
    // etc

    return d;

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

Don't put throw in constructors because that will require the calling program to put all the code that uses the class in one huge try/catch block. A better design is to have a constructor that doesn't need throw and then write another method that uses it.

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

Looking for running processes won't help with that problem because it doesn't tell you what the processes are doing. Launching other programs is the easy part, just a win32 api function call. Watching what other processes are doing will be a lot more complicated.

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

You want to call CreateProcess() The function isn't nearly as bad as it looks because some of the parameters can be 0 For example

STARTUPINFO sinfo;
PROCESS_INFORMATION pinfo;
memset(&sinfo,0,sizeof(STARTUPINFO));
sinfo.cb = sizeof(STARTUPINFO);
memset(&pinfo,0,sizeof(PROCESS_INFORMATION);

CreateProcess("Notepad.exe","c:\\logs\\Log.log",0,0,FALSE,0,0,0,&sinfo,&pinfo);
Graphix commented: Thank you, that did it! +6
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

this fixes it

void send_Message(send_request *msg)
{       
        printf("IN THIS BLOCK\n\n"); 
        msg->default_bearer.fteid = malloc(sizeof(fteid_t));
        msg->default_bearer.fteid->value = 1;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You don't need lines 5, 6 and 9 because fteid is never used for anything. That is not the same as the fteid on line 8.

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

You failed to use a loop, as explained in this and this posts

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

rand() is prototyped in stdlib.h

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

If you are going to do that then you don't need the BLINK attribute.

forever
   show text in color
   delay a few milliseconds
   erase text
   delay a few milliseconds
   generate another random color attribute
end of loop
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

did you bother to click that link or did you just read the suggested price?

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

The only way I can think of to change the color of the text on every blink is to write a clock interrupt function and change the color in that function. Clock ticks about once every millisecond, so your interrupt function will want to make the change only once every 1,000 ticks. Turbo C++ may have a compiler-specific function to help you with that, I don't know.

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

Look under "Legacy and other languages". COBOL is one of those ancient languages that is not used very much any more outside financial institutions such as banks. You probably won't find much help for it here at DaniWeb. You might start learning COBOL by reading some of these tutorials.

What operating system are you planning to use for your COBOL programs? Here are some free COBOL compilers for MS-Windows.

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

Ok, so now I'm blind. My eyes completely missed those links.:sweat:

jingda commented: You need another pair of eyes:) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Please tell me where to find the link

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

Tutorials? Plenty of them in the hardware and software forum, see them everyday:)

Oh really??? Where are they then? The only links to code snippets any more are from within the member's profile. But I don't want to search 50,000+ member's profiles just to find tutorials and/or code snippets.

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

what compiler? Code::Blocks and vc++ 2010 Express are both free.