• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Dyndrilliac

#31
So, I've been using Visual C++ 6 for a while now and recently it's started to really piss me off. So, I downloaded and installed the newest free beta of Visual C++, and I really like it. The only problem is, it didn't come with ANY of the standard Windows API headers (windows.h, winbase.h, etc). So, I was wondering, is there some new spiffy way of accessing what WAS available to me those headers, or am I shit out of luck with that?

Also, I'm wondering if it's safe to just copy over all the *.lib and *.h files that I have in my VC6 /include/ and /lib/ directories, and just tell it not to overwrite any files that already exist?
#32
Is there an easy way to keep track of all the different objects that I create, and then call their destructors, or automate the calling of the destructors?

Will calling their constructors manually get their destructors to be called?
#33
I ended up using malloc(), realloc(), and free() together, is that ok?
#34
Thanks, I didn't know it was that easy to figure it out.
#35
Can I use "delete" to do the same job as HeapFree() on a char* object, if I did not allocate it's memory through the use of "new"? I have a feeling the answer is no (the same feeling I have that this is a stupid question), because I also have a feeling that the memory is being allocated on the stack, but I don't know for sure.

Thanks, in advance.
#36
Well, My warning level is 4 and I have it set to treat warnings as errors.

Also, it isn't letting me pass a char* either. I replaced char String[] = "Hi! My name is Matt!"; with this:LPSTR String = "Hi! My name is Matt!"; And it still crashed. I changed my typedefs to:typedef char* LPSTR;
typedef const char* LPCSTR;
#37
C/C++ Programming / Re: C++ Compilers
November 15, 2005, 10:25 PM
Is that a joke?
#38
I'm using Microsoft Visual C++ 6. Is there an option I should have enabled somewhere to raise the awareness of warnings/errors? Anyway, I found a similar explanation at another resource. So does this mean I can't pass a char* or I just can't pass a char* when I don't assign it a variable name?

Resource: http://gcc.gnu.org/ml/gcc-bugs/2001-04/msg00587.html
#39
Well, I got it to *WORK* but I still don't know what's wrong with my original code...#include <vector.h>
#include <string.h>
#include <stdio.h>

typedef char*       LPTSTR;
typedef const char* LPCTSTR;

// Changed param 1 from char* to char[]
vector<LPTSTR> SplitString(char szTextBuffer[], LPCTSTR Delimiters);

int main() {
vector<LPTSTR> StringSet;
int i = 0;

char String[] = "Hi! My name is Matt!";
StringSet = SplitString(String, " ");

for (i = 0; i < StringSet.size(); i++) {
printf("%s\n", StringSet[i]);
}

return 0;
}

vector<LPTSTR> SplitString(char szTextBuffer[], LPCTSTR Delimiters) {
vector<LPTSTR> Results;
LPTSTR szTempBuffer = strtok(szTextBuffer, Delimiters);

while (szTempBuffer != NULL) {
Results.push_back(szTempBuffer);
szTempBuffer = strtok(NULL, Delimiters);
}

return (Results);
}
#40
C/C++ Programming / [C] String Problem [strtok()]
November 15, 2005, 02:40 PM
My program keeps crashing and I can't figure out for the life of me why.#include <vector.h>
#include <string.h>
#include <stdio.h>

typedef char*       LPTSTR;
typedef const char* LPCTSTR;

vector<LPTSTR> SplitString(LPTSTR szTextBuffer, LPCTSTR Delimiters);

int main() {
vector<LPTSTR> StringSet;
int i = 0;

StringSet = SplitString("Hi! My name is Matt!", " ");

for (i = 0; i < StringSet.size(); i++) {
printf("%s\n", StringSet[i]);
}

return 0;
}

vector<LPTSTR> SplitString(LPTSTR szTextBuffer, LPCTSTR Delimiters) {
vector<LPTSTR> Results;
LPTSTR szTempBuffer = strtok(szTextBuffer, Delimiters);

while (szTempBuffer != NULL) {
Results.push_back(szTempBuffer);
szTempBuffer = strtok(NULL, Delimiters);
}

return (Results);
}
It crashes on the line where 'szTempBuffer' is initialized at the top of the function definition of 'SplitString()'. All help on why this is happening and how to fix it is greatly appreciated.
#41
Well, the problem I was having was with this code:void BubbleSort(vector<double> &NumVector) {
    double dfTemp = 0;

    for (int x = 0; x < NumVector.size; x++) {
        for (int y = x + 1; y < NumVector.size; y++) {
            if (NumVector[y] < NumVector[x]) {
                dfTemp = NumVector[y];
                NumVector[y] = NumVector[x];
                NumVector[x] = dfTemp;
            }
        }
    }
}
I had gotten the following error:
Quote--------------------Configuration: SortingIntegers - Win32 Debug--------------------
Compiling...
SortingAlgorithms.cpp
C:\Documents and Settings\Matt\My Documents\Source Code\C++\Personal Projects\SortingIntegers\SortingAlgorithms.cpp(52) : error C2297: '<' : illegal, right operand has type 'unsigned int (__thiscall std::vector<double,class std::__default_alloc_temp
late<0,0> >::*)(void) const'
C:\Documents and Settings\Matt\My Documents\Source Code\C++\Personal Projects\SortingIntegers\SortingAlgorithms.cpp(53) : error C2297: '<' : illegal, right operand has type 'unsigned int (__thiscall std::vector<double,class std::__default_alloc_temp
late<0,0> >::*)(void) const'
Error executing cl.exe.

SortingAlgorithms.obj - 2 error(s), 0 warning(s)
And I then realized that I had forgotten to add the '()' after the Vector's 'size' method.
#42
Sorry, I fixed my problem already. I forgot to include the '()' after the vector 'size' method.
#43
It's called an array. Make an array of the controls with 50 elements a piece, then loop through it.
#44
Why not create a secondary buffer for the data to be lost? Place it in there and access it when you need it.
#45
C/C++ Programming / Re: Why is it so "heavy"?
July 12, 2005, 10:03 AM
It depends on if you want it to be programmed well or not so well depending on how fast you want it. C++ gives the programmer more control by forcing him/her to dictate everything the Application does. Simpler languages like VB do most of these tasks (I.E., handling threads/memory allocation) automatically. That's why VB is RAD, and C++ is not. VB and languages like it are meant for the rapid creation of programs. This is most useful in an office setting. C++ is designed to create planned precise programs that have been pre-designed.

C++ does have ways though that this can be overcome to a degree. One of it's more  redeeming features in the aspect of rapid program creation is it's extensive OOP capabilities (reusing pieces of old programs in new programs). Also, you can easily make a reusable application skeleton to speed up the process.