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

Read this thread It says only vs 2005 is supported.

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

I also mis the smilies -- will we ever get them back?

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

The editor looks ok to me. The only problem I have with it is that confusing instant preview, makes me think I have double vision problems :)

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

One error is that the character arrays xp and choice are not big enough -- you need to leave room for the string's null terminator. atoi() could return wrong values when the string does not contain a null terminator byte.

Since you include <string> header file you might as well use std::string instead of those character arrays so that you don't have to guess about how big to make character arrays.

Another suggestion is to convert coice and xp to integers before making those if statements so that atoi() is clled only once instead of dozdens of times. That will make your program run a little faster too.

P.S. also on a side note can any1 tell me how to delete intervals in a string

Use a loop and check each character for white space using isspace() macro found in ctype.h. If you use std::string instead of character arrays you can call it's erase() method which will delete the character. Otherwise, if you use character arrays you have to shift all bytes from point of space left one byte. One way to do that, and its also the most efficient way, is to call memmove().

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

That is only allocating one byte of memory! Why???

What is remainder? An array of integers? If that is true you don't need snprintf.. This will work, assuming the value of remainder[i] is < 126.because in C language char is just another int.

char str = remainder[i];
cout << str;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Why do you need a book for SqLite? Its just a standard SQL database, any SQL book will do. If you already know sql then you don't need a book at all, SqLite comes with several examples.

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

The error is in your code, not the compiler. You have written functions within a header file, then included that header file in two or more *.cpp files. You can't do that because you will get duplicate declaratkion errors just as you found out. Move those functions from header file into *.cpp file

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

I'm trying to write a simple Windows Forms program ( CLI/C++) . In the Form1 class I declared a private int, but the forms designer view hates it. Produces this error:

C++ CodeDOM parser error: Line: 195, Column: 15 --- Unknown type 'int'. ...

The program compioles with 0 errors and 0 warnings, its just the form designer craps out, and intellsense doesn't like it either. If I comment out the declaration the forms designer and intellsense are ok, but of course the program won't compiler because of uneclared int object.

I've been googling for this problem but have been unable to find any mention of it. Also unable to find a Microsoft forum for vs 2011 beta, maybe there is one but its not a public forum.

Has anyone else tried something similar?

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

Point 4. The value of elementsCount gets changed by the openFile

But not if you don't call openFile() first. For example I first added a new item then tried to save it to file. Doesn't work when called in that order.

BTW: You would have saved yourself an awful lot of debugging and grief had you used std::vector instead of dynamic arrays. std::vector does all the allocation for you.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Entry* resizeArrayCopy(Entry*& fpBuffer, const size_t resizeStep, size_t &bufferSize)
{
    Entry* pNewBuffer = new Entry[bufferSize + resizeStep];

    if(pNewBuffer == NULL)
    {
        return NULL;
    }

In the above, new does not return NULL, instead it throws an exception, If you want to test for NULL you have to add a try/catch block. Here is how to do it

Entry* resizeArrayCopy(Entry*& fpBuffer, const size_t resizeStep, size_t &bufferSize)
{
    Entry* pNewBuffer;
    try
    {
        pNewBuffer = new Entry[bufferSize + resizeStep];
    }
    catch(bad_alloc xa) { 
    cout << "Allocation Failure\n"; 
    return NULL; 
   } 
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are several problems with that program. There may be other problems that I have not yet found.

  1. addEntry() -- the first parameter needs to be passed by reference, not by value (See line below). That is because the array is reallocated at the start of the function, and that can not be seen by main() unless you pass a pointer to the pointer declared in main().
    void addEntry (Entry*& fpBuffer, int &elemCount,size_t &fBufferSize, size_t resizeStep);
  2. main() -- you need to initialize ALL the local variables because two integers are being used before they are initialized.
  3. Although not really a problem, since this is a c++ program the structure should contain std::string instead of char arrays. If you are not allowed to change that structure then you don't have any other choice, otherwise you should consider using string instead of char*.
  4. addEntry() -- the first if statement is incorrect. `if (elemCount==fBufferSize)' The value of elemSize is 0, the value of fpBuffer == NULL, and the value of fBufferSize is 4. You need to initialize fBufferSize to be 0 if you expect addEntry() to ever reallocate the pointer.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can buy a simple 9 pin adapter at most electronic supply stores, such as Radio Shack, Best Buy and Amazon Here are other suggestions

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

Post the code and error message. All C functions can be called by c++ programs.

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

Why do you think there should be a separate c++ version of that function? Just call it from your c++ program.

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

It was very fortunate that no one was injured -- it would most likely have killed anyone outdoors with no protection. As for my car -- it is a Ford Edge. Got to agree with you that it looks a little like an armored tank :)

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

My first password was probably "Waaaaaa!" -- when I was born :)

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

Update: that storm did $5,000 damage to the car and $11,000 damage to my house. Glad I had insurance :)

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

Is that all of the instructions you were given? I'm sort of surprised that your instructor didn't explain in greater detail what each of those methods were supposed to do.

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

The reason for the problem is because both FileTitle and FilePath are allocated on the stack, which disappears just as soon as the function returns. The solution is to pass the filename and path to the function as parameters so that they don't get destroyed when openFileDialog() returns.

BOOL OpenFileDialog(char*path, char* filename, bool InvertSlashes = false)



int main()
{
   char path[_MAX_PATH];
   char filename[_MAX_PATH];
   OPENFILENAME of = OpenFileDialog(path, filename);

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

According this link the data type of the file times in the stat structure are the same as time_t. Therefore all you have to do is call localtime() to get struct tm, for example

cout << strftime(mBuf, 18, "%I:%M:%S-%m/%d/%y", localtime(&sb.st_mtime));

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

There is no data type between them. One thing you could do is pack the integers into an unsigned char buffer then unpack them when needed. That is going to be a huge performance problem though.

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

What about european law that requires to delete all user data upon request?

What about them??? DaniWeb is hosted in USA, not europe.

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

The fade effect has been disabled since early yesterday,

Oh really ?? Everything still fades when the mouse hovers over an ad on Chrom.

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

Here is the code:

We need YOUR code not Microsoft's code.

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

Those are the two best compilers/IDEs for MS-Windows operating system. Exactly what are the problems you are having?

I am currently using code::blocks but i am experinsing trouble trying to link the ws2_32.lib

Code::Bloocks doesn't use libraries with *.lib extension -- it uses *.a because CB is calling a *nix port of g++ compiler. You need to link with libws2_32.a, not ws2_32.lib

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

Does 'printf' still work with c++ ?

Yes. C++ supports almost everything in C.

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

Maybe you should rethink how the information is displayed. For example, one way to do it is to use a tabbed form where each tab contains only a portion of the total info it now shows. Group the data into logical pages and present only one page, or tab, at a time. Someting on the order of the tabs many browsers use. That would greatly speed up repainting the window.

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

You want to create a win32 console project.

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

Yes --

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

You did not create a c++ project -- you created a CLI/C++ which is a different language.

As far as i know, System is a C# header.

No -- its also used in CLI/C++ which is another .NET language like C#. CLI/C++, C# and VC.NET are very similar languages

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

VC++ 2010 defaults to precompiled headers which requires stdafx.h. When you create a project you can uncheck that option. If the project is already created you can turn it off in Project --> Properties (last manu item under Projects).

Oh and if you know where to get a good tutorial about making a simple server-client side TCP chat program in C++ with winsock2.h

There is no such thing as a "simple tutorial".for that, and under MS-Windows you have no other choice but to use winsock. You might find some boost libraries to replace it. Also I have not use c++11 standards yet but it might also have something new. In any event you are going to need more than just a casual working knowledge of c++ to write that program.

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

Line 83 is asking for the number of items to be deleted, not which product. So the string contains numeric digits. If the product name in the list is in fact numeric digits then the function might work if one of the products happens to be the same as the number of items you want to delete. You need to rethink how that deleteNode() is working.

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

When working with arrays you need to have a counter that indicates how many valid items are in the array. If it's a dynamic array, such as one allocated with malloc(), you also need another counter (int) that indicates the current number of elements in the array. When you want to add another item (e.g. push_back) you need to check if the array needs to be expanded by comparing those two integers I just mentioned. If the array isn';t large enough you have two options: 1) ignore the new item, e.g. discard it, or 2) call realloc() to expand the array. Only arrays allocated with malloc() to begin with can be expanded like that.

As you can see, c++ vector class has saved you a whole lot of coding over the C counterpart (arrays). I like to put all that stuff in another function so that the main part of the program doesn't get so messy and difficult to read/maintain.

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

it all depends on how big your hard drive is, how full it is, and the unmoveable files. I have a 1 T hard drive with very little on it so when I srank it I got another partition with over 1/2 T.

You need to clean up your hard drive -- it has too much shit on it. Delete all the internet temp files and download files. If that isn't enough you will have to start uninstalling stuff or archive off files that you don't use, such as pictures and music.

I don't know where you live but here in USA you can buy usb flash drives that have several gig space, and you can use that to archive off some of your files.

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

Now that we know what you want to do, how about showing us what you have done, and tell us what problems you are having or what you don't understand. No one here will do that problem for you.

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

I did that on my PC. In disk management, click on the partition you want to split then select menu option shrink volume.

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

Because C is too old and unusable, i

C is older than c++ for sure, but hardly unusable! It's probably the most frequently used language in the world. Even today people are still writing code in C.

Before you can begin to convert your program from c++ to C you need to have at least a working knowledge of both languages so that you will know what the differences are. Just trying to compile that c++ program as if it were a c program won't work, as you have already found out.

The first thing you need to do is get rid of all those c++ header files and replace them with C standard header files. For example stdio.h, string.h, and stdlib.h. C doesn't know a thing about heder files with no extensions.

Next you need to convert c++ classes to structures and/or unions, then write normal global functions to processes those structures. The parameters to those functions will be a little different than the methods you find in c++ classes because C does not have a this pointer.

As for vectors, replace them with arrays.

Replace cout with printf() and cin with scanf(). Also replace fstream objects with FILE* and use fopen() and fclose() to open and close the file. The equivalent of c++ getline() is fgets()/

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

You can't do that with Turbo C++ because it's too old. Get a modern 32-bit compiler such as Code::Blocks or VC++ 2010 Express. Tubeo C++ is a MS-DOS only compiler.

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

I'm now logged in with Windows 8 Preview and IE9 on a PC. My only problem is that I don't see the purple bar across the bottom of the screen. Maybe DaniWeb thinks I'm on a mobile device?

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

I ALWAYS treat warnings in my own code as errors because most of the time they are errors. We need to know which header files cplusplus is using before we can suggest a solution to fix them.

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

@Captain: The link you posted is already on the second page. Press the left pointing < and it will take you back to the first page.

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

What thread are you talking about? (post the link to it). I have never seen that problem.

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

Do people who have ads disabled still see the fading? If they don't see the ads then how do they see the fading? And if they don't see the fading how can they be annoyed by it?

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

I just now noticed that change -- at first I thought my eyesight was going because everything got a lot dimmer. I don't find it annoying at all, now that I know its not just my eyes. It makes the ads stand out a lot better which might increase the click rate. I haven't seen this anywhere else -- maybe you should hurry up and patten the idea before others copycat it.

Nick Evan commented: Haha! +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First you have to use a loop to find the negative value. Once found, start another loop to compare each of the values from the beginning of the array to the one past the negative number.

For example: let int i be a counter that finds the negative number. Let j be a counter the counts from 0 up to the value of i (where the negative value is located) Now, in a loop compare array[i[ with array[j], then if they are the same increment both i and j. If it gets to the end of the array then both arrays are identical.

And no, I won't write it for you -- its your job to figure out how to do it.

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

1,000 new registrations = 999 spam bots :

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

ok, so make a lier out of me ) I just went back and it woked ok. I made several attempts to delete PMs and it the button would do nothing. oh well.

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

When I click the Delete button in PM nothing happens.

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

If you are on *nix you can just can opendir() function with path "*.ext". If it succeeds then you know that at least one file exists with that exteision. You can do the same on MS-Windows by calling FindFirstFile(). But if you want portablility between the two operating systems then use boost as previously suggested.

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

line 47: write(pipo, &arra[k], sizeof(arra));

Remove the & symvol -- arra[k] is already a pointer

line 55: free(arra[k]);

delete that line, arra can not be deleted.