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

The difference is that class* is a pointer passed by value, while class*& is a pointer passed for reference. Another way to do it is to pass class** (note two stars). Its the same idea as passing an int (or anything else for that matter), such as int is passed by value while int& is passed by reference.

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

You could use an array of function pointers and the index into the array could be the case values, for example

typedef struct 
{
   int (*fn)();
}fns;

int f1() {return 0;}
int f2() {return 0;}
int f3() {return 0;}
int f4() {return 0;}
int f5() {return 0;}
int f6() {return 0;}
int f7() {return 0;}
int f8() {return 0;}
int f9() {return 0;}
int f10() {return 0;}
int f11() {return 0;}
int f12() {return 0;}
int f13() {return 0;}
int f14() {return 0;}
int f15() {return 0;}

fns ptrs[] = {f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15};

int main()
{
    int something = 5;
    ptrs[something].fn(); // call the function pointer
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what kind of an array are you talking about? use strchr() or strstr() with character arrays.

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

>>It will probably also mean the end of US military imperialism (if the leaders are at all sensible).

And good, its about time US stops trying to be the world police force. IMHO we need to stop fighting other countries wars for them and stop instigating them.

debasisdas commented: agree +0
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

For *nix you will want to study Motif, which is not free unless you use OpenMotif. If you don't want their tools either then use X11R6 (there might be newer versions though). I'm sure you will find tutorials with google. And if you are going to write an extensive toolkit of your own you will want to buy the entire collections of X11R6 books.

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

Yes it does -- you must be doing something wrong or looking in the wrong place for the *.exe file.

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

I would make an array of tags then all the program needs to do is iterate through the array -- a lot easier than creating 50+ if statements. The array will make it a lot easier to add and/or delete tags too.

[edit]arkoenig has a better solution -- use a map.

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

You don't need to know anything about graphics if you write a command-line editor as Narue suggested. An example is Edlin text editor written by Microsoft. Study that link and you will get an idea how it works. I don't know if you can download it or not anymore.

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

The program you want to write is not for beginning students -- hell even professionals will have issues with it. If you are writing for MS-Windows you will need lots and lots of knowledge and experience with win32 api graphic functions. Study win32 api and write lots of programs for about a year and you might be ready to write that program.

Writing a text editor would be fairly simple in other languages, such as CLR/C++, C# or VB.NET, but not in C or C++.

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

Dev-C++ sucks. Use Code::Blocks. I don't know if it will solve that specific problem but it is a lot better IDE which is currently supported by whoever wrote it, unlike Dev-C++ where support is long dead.

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

Post the code that you have attempted. No one here is going to write your homework program for you.

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

The loop on line 37 will cause the stream to read the last line in the file twice. What you want is like below -- not necessary to test for eof() because getline() will stop when eof() is encountered.

while( getline(IN_transposeRowColumn,row) )
{
   // other code goes here
}

line 44: what is variable nr? I don't see it declared anywhere. And if nr is an integer then that line will only output one string, not the whole vector of strings. Is that what you want?

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

What browser are you using? I use both Chrome and IE9 and both of them work ok for me.

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

strdup()

it's the same as this

char* s = malloc(15); // allocate some memory
strcpy(s,"Hello");

>>the check determines the end of the .hex file
Maybe so, but the check is completly unnecessary as I pointed out in my previous post.

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

line 3 of sortBuff(). That array should be declared as char, not int because you are putting alphanumeric characters into it, not integers.

line 19 of sortBuff() -- why is that check even necessary?

while( line[i] != '\0')
{  
    if( line[i] == ':')
    {
       ++line;
       hexChar = 0;
    }
    else if( line[i] != 'F' && line[i+1] != 'F')
    {
        HexArrSort[line][hexChar++] = input[i];
    }
    ++i;        
}

Probably an even more efficient way to do that is to combine the two functions you posted and read each line directly into the array. Just call fgets() to read each line, something like this:

char** buffer = 0;
int numLines = 0;
int linesUsed = 0;
char line[80] = {0};
file = fopen("Project.hex", "rt"); // open in text mode
while( fgets(line, sizeof(line), file) )
{
    line[strlen(line)-1] = 0; // truncate '\n'
    if( linesUsed == numLines )
    {
       numLines += 10; // allocate  10 lines (pointers)
       buffer = realloc(buffer,numLines, sizeof(char*));
    }
    buffer[linesUsed] = strdup(line);
    ++linesUsed;
}
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

There isn't much that the President can do to get a bill on his desk for him to sign. Its all up to the members of congress to make that happen.

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

Now I really dont know what you mean? :)

Here is the help you seek

Now do the same with c++

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

hi;
i m student of MCS-1
i want to make a project in c++;
in dat i want to make window...
can any one hlp me and tell me how an i do so...?

If you are using MS-Windows then study this tutorial

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

I see thousands of stars but don't claim to see two suns (except when I was drunk)

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

I knew M$ was going to do that but was wondering they they never did it. Oh well, I would not have ever used it anyway for the reasons others here said about Google OS.

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

At this point we don't know what will and what will not get paid. What should NOT get paid are all members of Congress, the Senate and the President. Those should be the first to go. Let them starve until they get this mess straightened out.

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

Here is a list of the current investments. I misstated that they were T bills.

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

The feds get money all the time from different sources, such as taxes. People and corporations in USA frequently make tax payments monthly instead of annually, so the cash flow into the treasury is never constant or predictable (at least not for us normal folks). Its probably predictable for those who constantly study those things. Even if Congress doesn't raise the debt ceiling it doesn't mean they can't pay any bills, it just means some bills may be paid late, others will still be paid on time.

>>The USA isn't in any financial difficulties nor in any debt because it has a couple of trillion $ it can cash?

That's not what I said. I said the Social Security Fund is not in any financial crises at the moment. SS checks will be mailed out as normal in August.

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

The US fed government is not going to go bankrupt. It will still pay bills, such as social security, military and federal service employees, as money becomes available. I heard on radio just yesterday that social security is not in trouble because it owns a couple trillion dollars in US government treasury bills which, if pressed for money, they can cash.

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

add a break statement after line 6 to stop the loop, otherwise the program will just keep on looking for spaces.

>>I'm not 100% confident I wrote that correctly
The easiest way to determine if the code you write works correctly is to run it several times using different input strings. Then in the printf() statement surround the resulting string with quotes printf("show name = \"%s\"\n", char_buffer);

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

You mean you have a MS-Windows full-screen program and you just want to put a listbox on the window that contains the same functionality as the OpenFileName common dialog box? I'm not familiar with how StarCraft displays a list of maps, maybe you can post a thumbnail picture of it.

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

line 82: use == operator, not = assignment operator. Same on other if statements.

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

Madeon on YouTube

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

On DaniWeb???? Probably not. Our members would not do anything like that.

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

It will, but you will have to rearrange the dates in yyyymmdd format first, where 12/10/2009 becomes 20091210 and a date like 12/1/2009 would become 20091202 (force 0 leading month and day to make then 2 digits). Put all date strings in std::string objects then you can use > and < operators to test whether a particular date falls between the two date ranges.

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

Independence Day movie was only released in 1996. If you have not seen it and you are a sci-fi fan then you need to get it. You can most likely get it from NetFlix in USA.

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

Oh, I see. Well, all those secrets were exposed the public in the movie Independence Day.

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

Has anyone seen the movie 'Area 51' ?

Since it hasn't been released yet (linky here), I doubt it.

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

>>Surely there exist coding best practices to avoid buffer overflows.
C language will let you shoot yourself in the foot and has been the cause of untold hours of debugging. I suppose the best practice is to allocate all new memory for the destination buffer. This may introduce memory leaks if the calling function fails to deallocate the pointer.

char* foo(char* str1, char*str2)
{
   char* str3 = malloc( strlen(str1) + strlen(str2) + 1);
   strcpy(str3,str1);
   strcat(str3,str2);
   return str3;
}

sizeof(str1) will only give you the size of the character buffer if str1 is declared inside the same function. If st1 is declared anywhere else then sizeof(str1) only gives you the size of a pointer -- 4 with 32-bit compilers.