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

And a Dr. Pepper can will emit vibration if you squeeze it. The crinkling aluminum produces the vibration of sound waves.

My wife does that too :)

ddanbe commented: Long time ago I had such a laugh! +5
Aia commented: A complete show of lack of class. -3
tux4life commented: :D +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The can of Dr Pepper I am now drinking doesn't emit any vibrations on its own, so that theory is proved false.

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

Did you try using track without pointers?

Watch_t *tr; Watch_t track;
	int bool;

	init_track( &track );

	track.hash = "t8xr5nk8jczy";
	track.id = 1; track.views = 16;
// etc etc
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Hmm MessageBox(0,"Message body", "Message title", MB_OK ); doesnt work. Ive included windows.h but nothing. It complies with no errors and no warnings but just (blank program) tells me press any key to continue...

It worked ok for me. What compiler did you use? Mine is VC++ 2008 Express.

#include <windows.h>

int main()
{
    MessageBox(0,"Message body", "Message title", MB_OK );
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why don't you just ask their support group? Its unlikely anyone here will know anything about that library, but then I could be wrong about that.

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

hey..will anyone tell me how to browse files and folders in a drive using C??

Depends on the operating system.

  • MS-Windows: FindFirstFile() and FindNextFile().
  • *nix: opedir(), readdir()

Google for those key words and you will find more information about how to use those functions.

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

who or what is libJudy? (don't tell me its a library because I already guessed that :) )

Salem commented: libJudy implements a "Judge" method ;) +31
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I would stick with the conventional method. Why? Because it makes the program easier to read and understand. And the next guy who has to maintain your program will hate you for that code. Use the KISS principal (Keep It Simple Stupid)

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

>>What do you think of this technique, is it useful
I never used or seen that technique -- I would have just done this:

mc.Foo();
mc.Bar();
mc.Pancakes("flour etc.");

>>Didn't know you could use this like *this
That is a very useful technique to remember because its use a lot, especially when you want to override the << and >> operators.

>>By the by, is this how they structured PHP?
No idea.

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

first copy the nodes in each queu until either A or B are empty. After that copy the nodes in the remaining tree until it is empty. If the nodes of each queue are the same structure then you can just copy the address of the nodes from A and B to queue C. If the structures in A and B are different, then you will have to rebuild the nodes of C.

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

you are close

#include <iostream>
#include <string>
#include <cstring>
using namespace std;

class MyClass{
public:
	MyClass Foo();
	MyClass Bar();
	MyClass Pancakes(string ingredients);
};

MyClass MyClass::Foo(){
	cout<<"Inside foo\n";
	return *this;
}

MyClass MyClass::Bar(){
	cout<<"Inside bar\n";
	return *this;
}

MyClass MyClass::Pancakes(string ingredients){
	cout<<"To make pancakes you need: " << ingredients << "\n";
	return *this;
}

int main(){
	MyClass mc;
	mc.Foo().Bar().Pancakes("flour etc.");
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You really need to fix the problem instead of trying to hid it.Try commenting out large blocks of code until the program no longer produces those errors. That will narrow down your search for the problem.

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

The only add-on is Talkback.

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

Ah, that explains alot! How about making a global variable static?... will that make the global only known within the... eh.. file?

That's correct. The static keyword works a little differently when used within a c++ class. Here are some google links for more information.

Also, how do you destroy a static vector? or a vector in general for that matter?
(Thinking of adding a DestroyHandle() function)

Since main() has a pointer to it then just use the vector's erase() method to destroy it. menu->erase(); Do not attempt to delete that pointer!

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

Ah, hahaha, just adding the 'static' made everything work.
So, a static variable is like declaring it in the global scope?

Yes, but when declared inside a function it only has scope within that function.

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

just like your original post, but make the vector static static vector<string> v;

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

why are you trying to dynamically allocate that array? Just hard-code it bool visited[11][55]; then delete lines 4 and 11.

If it must be dynamically allocated, then you will have to do it like this:

visited = new bool*[11];
      for(int i = 0; i < 11; i++)
          visited[i] = new bool[55];
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The code you posted is slightly different than the code in the origina post in that this new version returns a complete vector, not just a pointer. When CreateHandle() returns the compiler will duplicate the entire vector before leaving the function, then duplicate it all over again on line 16 for vector menu. For large vectors that can be very very time consuming which would not be acceptable in any professional program.

There are two alternatives:
1) make the vector static so that its contents are never ever destroyed until the program itself exists, then return a pointer to it.

2) pass it by reference as I previously mentioned.

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

>>Anyone know why this doesn't work?
Because the vector is destroyed when function testor() returns to its caller. A better way is to pass the vector by reference to testor()

void testor(vector<string>& v)
{
	v.push_back("Lolzer");
}

int main()
{
    vector<string> v;
    testor(v);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What operating system (and version) are you using? You may have to go to Tools --> Compiler Options --> Directories also in Programs tab, then add the full path to all files and programs

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

Do you have any Thunderbird extensions installed?

No extensions that I know of. I assumed that music was a common (standard) feature of Thunderbird.

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

1) What if my line is over 1024 chars????????? how should I fix my code to handle that situstion

If you want to read the entire line at one time then just declare the input character array to be large enough to hold the largest possible line.

>>If there is no '\n' at the end of the buffer you only got part of the line.
Maybe yes, and maybe no. The '\n' is appended only if there is one in the file. Sometimes the last line of the file does not have '\n' at the end. So in that case the program would have to check the next read to see if fgets() reached end-of-file.


>>I do not want to use char * lokking for any stringbuf or anything alike in c++ to use fgets()

That has already been answered, and the answer is that it can not be done (easily). But what you could do is something like this:

char cline[2048];
std::string sline; 

while( fgets(cline, sizeof(cline), infp)
{
    char* ptr;
    if( (ptr = strchr(cline, '\n')) != NULL)
    {
          *ptr = 0; // truncate the '\n' character
          sline += cline;
          // do something with this line
    }
}

The code above would have to be a little more complex, but I think you get the idea.

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

If you post the complete program (or some test code) then we can test it on our computers to see what it returns.

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

It doesn't compile with VC++ 2008 Express either. The compiler didn't like the preprocessor directive on line 1002, chkconf.h. So I changed it to this:

#ifdef wxUSE_CRASHREPORT
#if !wxUSE_ON_FATAL_EXCEPTION
#   ifdef wxABORT_ON_CONFIG_ERROR
#       error "wxUSE_CRASHREPORT requires wxUSE_ON_FATAL_EXCEPTION"
#   else
#       undef wxUSE_CRASHREPORT
#       define wxUSE_CRASHREPORT 0
#   endif
#endif /* wxUSE_CRASHREPORT */
#endif

After that, the compiler issued the error message on line 1819. error "wxClipboard requires wxDataObject"

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

I think it does it on only spam emails

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

I give up. Read post #14 again.

William Hemsworth commented: Hang in there :) +10
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Thanks for the suggestion, but it's not a Windows sound, which is just a short musical note. What I am talking about is like an entire opera!

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

but i was asking when my array
int arr[] = {10,20,30,40,50,60,70,80,90,100};
or

int arr[] = {10,20,30,40,50,60,70,80,90,100,10,20,30,40,50,60,70,80,90,100};

For this how to write the code so i got the output..

You don't read very well do you?? This line takes care of that int count=sizeof(arr)/sizeof(int);

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

binary files have the advantage that they normally have fixed-length records and are faster read/write operations. All large databases use binary fines because of (1) speed, (2)random access, and (3) ability to change a record without rewriting the entire file (assuming fixed-length records). The disadvanges (1) non-human readable, so you can't use a text editor to view the file contents, (2) difficult to change record format (e.g. add or remove a field in the record)

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

You need two sets of loops. The first loop will only display the values of the array.

for (i=0;i<count;i++)
  {
      printf("%d\n",arr[i]);
  }

Then you need another set of loops, similar to the one you already posted, but just prints printf("%d + %d\n",arr[i],arr[j]); >>but when my array having length varies means for any length of array what to do??
Your program already takes care of that. Change the array size, recompile, and rerun to see what happens.

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

BTW, Why is there actually need for the file being opened in binary mode? Why don't you just use the text mode ?

Because the file apparently contains the binary (or computer internal storage) values of the data, which are not human-readable and not text. Such files can not be opened in text mode.

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

How do i open the file?

inFile.open(str); Note that scanf() will not allow spaces in the text, so if the filename and/or path contains spaces then you need to use getline() instead of scanf().

tux4life commented: I didn't think of that, but it's absolutely right ! +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Any way to turn off that annoying music when a new message arrives :@ I have already unchecked the items in Play A Sound when new message arrives, but the music still persists.

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

Everyone gets bad rep from time-to-time, don't worry about it. Feel lucky I didn't give that bad rep because it would have cost you 23 points instead of the 4 points Killer_Typo gave you.

~s.o.s~ commented: Is this a threat or wut? :-) +28
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I want it to work can anyone help me
Probably not. Attach it to your thread here so people can easily download it. Just hit the Go Advanced button, then the Manage Attachments button.

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

>>I am searching for a way to identify a computer so a software can recognice that computer in order to work.

There really is no idiot-proof way to prevent someone from doing that. Its just like encryption code -- it only works for the novice. A good hacker could probably break any method you try to use.

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

>>But I need to know what are the best practices for code sharing, like:

For every 1,000 programmers there are 1,000 coding styles! Every coder develops his/her own coding style or use the coding style standard set by the company. A good place to start is the links that siddhant posted and by reading current programming books, paying attention to the coding styles presented on those books. Eventually you will develop your own style in a way that makes sense to you.

There is no such thing as a "deprecated coding standard or style" because there were never any official C or C++ coding standards to begin with.

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

as you can have more than one NIC and it is more likely to be changed than your hard drive

Computers can also have multiple hard drives. And I've changed hard drives more frequently than NICs. Possibly there is some unique ID in the bios that can be retrieved, I don't know.

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

what operating system? More than likely someone changed the password without your knowledge.

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

You could create an array of pointers

class Holding
{
   // blabla
};
class Derived :public Holding
{
  // blabla
};

Holding **array = new Holding*[size];
// add a class of type derived
Derived* dv = new Derived;
array[0] = dv;
BestJewSinceJC commented: patient, multiple solutions... +5
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Abstract classes (I presume you mean it contains one or more pure virtual functions) can not be instantiated by themselves. So there is no way to make an array of them. You could, however make a vector of them vector<Holding*> array;

#include <vector>
using namespace std;

class A
{
public:
    A() {x = 0;}
    virtual void foo() = 0;
private:
    int x;
};

int main()
{
    vector<A*> array;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Is there an easy/fast way to convert C++ with class structure, etc to C?

No. First convert the class to a structure and remove all its methods as well as access rights (public, protected, private). If it has base class(s) you will have to remove them too.
Next, convert class methods into normal functions and add a structure pointer as one of the function parameters (most likely make it the first argument).

>>The definitions are proprietary to another company
If the library has C style linkage then you probably won't have to do much other than use the library(s) as-is.

If the library is c++ then you may have big problems because C can not normally call C++ functions. You will have to write c++ wrappers for those library functions that can be called by C, which means you will not be able to completely eliminate c++ from, your program.

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

use the new operator to allocate dynamic memory Holding *holdLib = new Holding[size];

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

lines 36 and 37: delete these lines because they are just a temp pointers and can not be deleted.

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

Yes, that's called a message pump. So your wait() function could be this:

void DoMessagePump()
{
    MSG msg;
    while(GetMessage(&msg, hwnd, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

}
void wait ( int seconds )
{
  clock_t endwait;
  endwait = clock () + seconds * CLOCKS_PER_SEC ;
  while (clock() < endwait) 
  {
     DoMessagePump();
  }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Maybe it works with the system command:

#include <stdio.h>
#include <stdlib.h>

int main()
{
/* not net send under vista, and msg is interactive*/
system("dir");
return 0;
}

To generate a popup, you have to use MFC . ....

You both flunked the course because you are both wrong. Out of three responses to this question only one person got it correct.

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

I see no reason why that compiler could not support Secure FTP -- FTP is not part of the C or C++ languages, so you would have to get the code in the form of a 3d party library. I have not done it myself, so I would be little help to you. If you are writing unmanaged code then Curl should work ok.

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

because no memory has been allocated to aSome -- its nothing more than a pointer that has a random address.

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

Sounds like you need to post in Job Offers -- someone might help you if you want to pay $$$ for their work.

nexocentric commented: So right! So right! I'm volunteering though..... +1