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

Your compiler is correct. void main() is non-standard, the c and c++ standards require main() to return an int. Change your program to int main() and it will be standards conforment.

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

Depends on the console app, how difficult is it to take an existing house and convert it to a 4 star hotel?? In one extreme you will have to tear it down and start all over from scratch.

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

pass the destination string by reference to the DLL function.

// dll function

// assumes the application program has allocated memory for the string.
void foo(std::string& s)
{
   int k = 0;
   for(int i = 0; i < 5; i++)_
   {
      for(int j= 0; j < 5; j++)
         s[k++] = GenrateRandomDigit();
      if(i < 5)
          s[k++] = '-';
   }
}

// application program
int main()
{
   std::string s;
   // allocate memory for the string
   s.reserve(30);
   foo(s);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You could use any of them, but IMO Windows Forms (CLR/C++) or C# would be easiest to port that console program. If you want the program to be cross platform on both MS-Windows and *nix then wsWidgets might be better.

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

Yes product keys are only one use for them. I've even seen UUIDs used as part of code guards in header files.

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

The format of that string is enough to make me not want to reply without further information. What is the purpose of you wanting to generate a uuid in that particular format?

UUIDs are in that format, and are used a lot in MS-Windows programming to uniquely identify objects. Just look in the registry and you will find millions of them.

Thanks guys but how would you split the steing into blocks such as; xxxxx-xxxxx-xxxxx-xxxxx-xxxxx where x represents a character

That's quite simple -- add the dashes when you generate the characters.

std::string uuid;
for(int i = 0; i < 5; i++)
{
   for(int j = 0; j < 5; j++)
   {
      uuid += GenerateRandomDigit();
   }
   uuid += '-';
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

just call rand() to generate random characters between 48 to 57 and 65 to 90 (see any ascii chart)

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

>>Some gd example are.

That is a perfect example why we should NOT use leet or chatroom speak. Does gd mean "god dam" or good?

Salem commented: rep toy++ +17
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What forums are you talking about? DaniWeb has no forums devoted to viruses. And any discussion about them might get you banned. You have to be very very careful about what you say of that topic, so its best just to not discuss that topic at all, except maybe to find out how to clear a virus or about antivirus programs in general.

If you have a gripe about a particular moderator, PM ~S.O.S~, Narue, or HappyGeek with your complaint.

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

Its illegal to write viruses -- you can go to prison for that. I would castrate without anastasia those who do that if I could get my hands on them. Me hostile?? No, not one bit.

WaltP commented: I wouldn't use Anatasia either -- the Czar would be mad! +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This article from SodaHead made me mad as hell. Delta airlines should be ashamed of itself for the outrageous act against returning service members.

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

>>*(mpg+ctr) = *(miles+ctr) / *(gallons+ ctr);

That's the same thing as this: mpg[ctr] = miles[ctr] / gallons[ctr]; Personally I do not like or use the pointer arithmetic as shown in your code snippet, but its just a matter of personal taste. IMO using the index method I show is a lot more clear what is going on, and of course requires little thinking about it. Programmers should write for clarity, not cuteness or an attempt to impress others.

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

>> which would presumably be 256 in this case?
why 256? sizeof(double) != 256, so where did you get that number?

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

That makes no sense. If T is type double how is the function supposed to convert the double to a single ascii character???

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

You can't. templates take on a data type when they are declared. For example vector<int> list; is a vector of integers. Once declared it can not be changed to a vector of strings or something else.

But then again, maybe I misunderstood the question. Post an example of what you want to do

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

That is the wrong way to go about clearing the keyboard input buffer. Narue has written an excellent article about that very topic. See this link

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

I always hated bourbons and whiskeys. My favorites were gin & tonic, vodka and kahula (black russian). Ho Hum -- that's what happens when you get old, you have to give up all those things. Now I just drink unsweetened ice tea, diet soda, and bottled water.

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

The first thing you need to learn is how to write assembly code. google for tutorials and you will find them.

c++ programs can access functions written in C or assembly by declaring the function prototypes as extern 'C' extern "C" void foo();

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

Since | character is not a number you can not use cin>>num for data entry. Use sometime other than | for data termination, such as -1.

Second problem is that the Enter key '\n' is left in the keyboard buffer after numeric input. cin>>num does not remove it.

You need to do two things
1) clear the cin error
2) flush the input buffer of all remaining key values. See this link for the expanation

cin.clear();
    cin.ignore ( std::numeric_limits<std::streamsize>::max(), cin.widen ( '\n' ) );
mike_2000_17 commented: 954th thread about cin.ignore() on Daniweb! +11
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Huh? You'll have to be a lot more specific about what you want. Such as you have a library of functions written and assembles with masm that you want to call from Turbo C++??

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

>>compile the main file using this libraries(header file) and you'll see some thing strange really strange!!!

Ok, I give up. What is so strange?? and please be specific.

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

Like all Microsoft's certs, college degree is not mandatory. Some people have passed the cert tests without ever reading a book, which is one reason IMO they are almost next to useless. But Narue could respond to that better than I can.

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

The function wants all of the strings, not just one of them. If you want to pass just a single string then you will have to change the signature of the function to getCatArrAndVals(char *s)

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

Lines 24 and 26 are not calling the functions. Those two lines are just function prototypes, just like lines 7 and 8.

To call a function you leave out the data types. Example function call: calculate (num1, num2, num3, num4)

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

>>DOS runs in segmented mode, and jumps into Protected Mode when needed.
MS-DOS version 6.X and older never ever jumped into protected mode for anything. You had to use a DOS extender (one such as by Pharlap) to get into protected mode.

And its called real mode, not segmented mode.

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

For starters, line 16 and 18 are incorrect. To call a function you need ( and ), such as getInput(); You also have to add all the necessary parameters, such as those that calculate() require.

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

Ok so you might be right about the SAS part. But the os only does low-level drawing. The os knows nothing about what the application program is doing. Some programmer had to write that program which is displayed when Ctrl+Alt+Del is hit on the keyboard. It's nothing more or less than another application program, just as MS-Word and MS-Paint are application programs. The operating system itself can run just fine without the help of any of those programs.

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

>>however when i copy the structure definition to my code , it complains its already defined in time.h ?

You are not supposed to copy standard C structures into your code -- juse use the #include <time.h> statement .

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

>>what i was looking for was not allocating the whole ja[15] array structure at the start but only 3 members of it , and expanding as the user enters more

Yes that can be fairly easily done by declaring ja as a pointer and not an array. Each time you use an item of the array you have to increment nItemsUsed.

struct  jatekos* ja = malloc(sizeof(struct jatekos) * 3); // allocate 3 members
int jaSize = 3;
int nItemsUsed = 0;

// now in a loop or something start filling the array
// when the array is full then reallocate it to a larger size
if( nItemsUsed == jaSize)
{
   // bump size by 5 items
   jaSize += 5;
   // now reallocate the array
   ja = realloc(ja, sizeof(struct jatekos) * jaSize);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>@WaltP: It is better, because that's what is the standard:

>>@AncientDragon:
>>I read my own links, and I do not know why did you ask that.

I said that because the link you posted said no such thing. You are attempting to make us believe Bjarne said something that he did not, and that constitutes a flat-out lie.

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

Narue is ALMOST correct. If you are going to use fread() then the file should be opened in binary mode, such as using "rb" instead of just "r" FILE *in = fopen("test.txt", "rb");

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

>>int length = fread(buf, 1, sizeof(buf), inputFile);

That is not how you get the length of a file. First you have to call fseek() to move the file pointer to end-of-file, then call ftell() to get the file position.

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

You mean you don't even read your own links ???

A conforming implementation accepts

int main() { /* ... */ }

and

int main(int argc, char* argv[]) { /* ... */ }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are several (many) sort algorithms to choose from. Did your instructor tell you which one to use? The simplest one to code is called the bubble sort, but its also the most time consuming to run. Just google for "bubble sort" and you will find example code that you can use.

BTW: No one here will write the program for you. Its your job to learn how to write the programs. We just help out by answering specific questions you might have.

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

I have several computers all on a home network running Windows 7 OS, all connected to a router. What do I need to do to convert them to IPV6 protocol? Just buy new network cards?

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

I saw a bear as well.

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

1.
you should be reading a tutorial on win32 api functions. But anyway, here is how cursors are created.

2.
Probably uses windows hooks to capture keyboard events.

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

There are lots of ways to create GUI ms-windows applications. One of them is by using CLR/C++ Windows Forms, another using wxWindows c++ classes, or pure win32 api functions

Here are a few tutorials for you to consider

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

beef stew cooked in a slow cooker for about 8 hours.

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

1. No.

2. That does not add members to the structure, it declared 15 objects of the structure. A better way to do that is by using an array of structs e.g. jatekos array[15]; // declare 15 objects of type jatekos 3. Ok the code you posted here makes more sense. Here again, like above, you need to declare an array of those structures.

struct jatekos ja[15];

while(getline(tmp,20)>0){
   strcpy(ja[i].nev,temp)
   i++
}

//or like this, eliminating the need for temp array
while(getline(ja[i].nev20)>0){
   i++
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Some compilers may produce warnings if you declare main() with arguments and never use them. Use int main() if your program does not need command-line arguments, otherwise use the version with two arguments.

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

Has anyone actually read the assignment he posted??? It makes absolutely no sense.

>>The user will input the sum of each row and each column.
So the programmer creates a 3x3 array. How is the user supposed to know what the sum of the rows and columns are -- the array at that point just contains some random values, whatever happened to be on the stack at the time the array is created.

>>Then the user will input 3 values and store them anywhere, or any location or index,

Just more nonsense. So what if I store it in array[rand()][rand()]; That's not very likely to work.

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

You are more than likely corrupting the stack with that huge array. Move the array into global, outside any function, such as move line 8 just after line 4.

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

That said I'm ok too, but will not be able to connect to IPV6 only sites. AFAIK that won't be a problem for me.

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

Your first link said I do not have IPV6 but I should not have any problems either.

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

strange -- the only thing the compiler will accept on line 11 is a string literal.

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

must be a problem with your computer because IE8/9 has no problems with it for me. Don't blame M$ for something that may be your own fault.

But I also noticed its not DaniWeb but it happens everywhere.

WaltP commented: Of course it's my fault. I didn't set IE up. And since it can't figure out how I connect by checking the system itself, (and I don't like IE anyway) I'll just let it be a cripple. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You assign the array size to an int variable, then return "true" if that variable is equal to zero..

You have to pass the array size as another parameter. The function prototype he posted is incomplete.

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

how was the file opened? The file needs to be opened for either reading only or both reading and writing, such as in the example here

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

t.c is nothing more than a pointer that has no memory allocated to it. scanf() does NOT allocate the memory for you, you have to do that yourself. Change the structure to something like this and it will work.

struct a
{
   char c[255];
   int b;
};