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

line 23 is looking for the end of the first word, but then you display the entire line on line 27. before the break on line 25 you need to truncate the string at the end of the first word. First call std::string's find() method to get the position of the first space, then call std::string's substr() method to extract just the first word.

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

Both getchar() and EOF return int, not char.

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

where did you get sdl.h from?

example868 commented: it is an api +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In copy() you need to null-terminate the string at line 50 because that while statement doesn't do it.

The main problem is line 16, it's missing required parentheses.

while ( (len = getline(line, MAXLINE)) > 0)

line 31-38 are also incorrect. The only way to get EOF is to press Ctrl+Z, which is not even necessary. Just pressing Enter is sufficient to break out of the loop.

    for (i = 0; i<lim - 1 && (c = getchar()) != '\n'; ++i)
        s[i] = c;
    s[i] = '\0';
    return i;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

vanilla ice cream

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

Not according to this article.

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

But when i compile the program it give the error:

what Error(s)? post the error messages

what compiler and operating system are you using?

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

move line 27 down to line 38 because you are throwing out the first token in the string.

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

you mean this? It's highly unlikely anyone here will know anything about it. You will be better off to ask in their forums.

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

Just use any text editor, If you are on MS-Windows then Notepad++ is a good one to use because it has color highlighting.

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

what grid? c++ doesn't support grids natively. We need more info about your compiler, operating syste, and GUI library.

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

Do you have a question?

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

move lines 43 and 44 up between lines 40 and 41 so that they are within the if statement that start on line 27. The way it is now you are re-writing the struture whether it needs to be changed or not. Only write the structure if something has been changed.

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

what is the error message?

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

Dannon Oikos Greek Nonfat Yogurt -- yummmmy!

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

unless MSDN says otherwise, controls don't work with them. You have to expand those yourself before sending text to the control.

cambalinho commented: thanks +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

he did say that the issue may lie in compiler

Very doubtful. You need to compile for debug then use VS debugger to single step through the program and look at the value of variables. Such problems can be difficult to find, but almost never the fault of the compiler.

Post the program so we can try to duplicate the error.

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

My lungs because can't live without them.

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

He fixed it now.

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

It takes an unusually long time for PFO to respond to link clicks. I don't think it's my computer because DaniWeb and other sites are ok.

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

My son barbecued today, had brots, pork steaks, corn on the cob, and sweet potatoes.

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

Example: "I should of done it" vs "I should have done it".

Guilty. Many native English speakers pick up bad habbits from parents and other people. And you are correct that non-English people often write/spek English better than native English people. I see that quite often right here where I live. There are a lot of adults who are functionally illeterate.

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

Then get started studying previous suggestions because no one here will do it for you.

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

Here is a good tutorial on win32 api GUI programs. You can do it in either C or C++.

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

Note:I dont know anything about c++.

Good luck! Do you know anthing about programming at all? If not you are in very deep cow dodo.

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

Ask for a double espresso, now that's caffeine :)

You mean that's cow dodo.

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

Why did you convert from 2d to 1d array? Why not just read it into a 1d array to begin with?

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

You're right, this doesn't really work

`while (getline(myfile, line, ','))`

because when the last numbe on the line is read getline() does not stop until it reaches the next comma. Your's is a much easier and safer solution.

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

KFC chicken breast, original recipe.

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

@AD What does line 7 do? I have never seen that.

It's an error. Sorry about that. That's what happens to old men who try to think too much :)

while( std::getline(myfile,line,',') )

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

Have you tried ADOCE DLL? I haven't used it in several years now but it worked about 10 years ago.

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

contrary to popular belief, the Earth is flat and the sun revolves around it. The Earth is also only 10,000 years old.

Reverend Jim commented: I was hoping we could keep this factual. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your program is doing way too much work! There's an easier way to do it. The code below does NO error checking so you might want to add that.

ifstream myfile("CS DataSet.txt");

std::string line;
int nums[20][5];
int row = 0;
int col = 0;
while( myfile(line,',')
{
   nums[row][col] = atoi(line.c_str());
   col++;
   if(col > 5)
   {
      col = 0;
      row++;
   }
}

// now you can sort the array however you wish
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Cold and wet. I had to turn the furnace back on to take off the chill.

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

I don't think that is a real word. Comes from the movie Mary Poppins and, AFAIK, does not appear in any American dictionary, but was added to Oxford Dictionary in 1986.

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

The problem is not how it's spelled but how it's pronounced. Ho and Hoe are both pronounced the same. Some people have objected to Santa saying that word.

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

start out simple. First just write a progam thad declares an array of 20 floats. The expand the program to fill the array with 20 values. Once you get that done and tested you can continue the problem a little bit at a time.

This is called "divide and conquer" method of programming and is very efficient because you don't have a huge number of errors to correct all at the same time.

Please post the code you have written and ask specific questions about what you don't understand.

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

Something like I posted WILL make the first argument like that. You don't have to use string literals as the first argument -- it can be a formatted char array.

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

Oh and I dont know your exact age, but please try to live forever

Happly that isn't going to happen :) I don't want to live forever, too much trouble.

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

If such complications arise for the process writing C libraries for use with MASM, I can only assume that the two were never intended to be mixed in such a way.

Incorrect. You just need to understand how all that fits together.

My instructor, however, maintains that there is a portability between C and Assembly,

He is correct. It's been my experience that you write the main part of the program in C and use assembly to optimize critical parts. That way let the C compiler figure out what all libraries has to be linked.

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

The actual executable code for printf is contained in a library. I don't know which one it is for Turbo C. You may have to link your assembly program with several standard C libraries because printf may call functions in other libraries, which in turn call more functions in some more libraries. When you write a plain C program the compiler already knows about all those libraries and produces the correct link statements for you. With MASM, and other assemblers, you are on your own.

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

Why why why?

Because you also have to link with standard C small libraries that are in Turbo C install folders.

In your assembly code you can delete lines 16 and 17 because those two registers are not being used by your program.

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

Did you also use the small memory model with Turbo C?

When you linked the assembled code did you tell the linker to also use the *.lib file along with the *.obj file geenrated by masm?

If you did all that then I suspect there are linking problems between masm (Microsoft) and Turbo C++ (Borland) object files. In that case you will need to replace MASM with TASM (Borland assembler)

Also, ask your instructor what compiler you are supposed to use with MASM. There is an old Microsoft C comiler, but AFAIK it is not free.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
printf("\rLoading ...");
// after timer expires
printf("\r           ");

The "\r" moves the cursor back to the beginning of the line without changing lines.

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

Is that in response to a program you wrote? What compiler did you use? there are many ways to figure out where the problem lies -- one way is to put a bunch of print statements everywhere so that you can see where the program stopped when the error message appears. Another way is t0 learn how your compiler's debugger works.

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

what is "uml" ?

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

Just get the port number from the user then format a string, something like this. The code may not be exactly correct, I didn't test it.

int port = 0;
cout << "Enter port number\n";
cin >> port;
stringstream str;
str << "\\\\.\\Com";
str << port;

CreateFile(str.str(), ... );
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I guess I misunderstood the assignment. To me, "sum up the vectors" means c[0] = sum(a) + sum(b)

Sorry, I can't test your program because I'm using MS-Windows and pthread.h is not supported there. c++11 standards supports threads directly now so you don't need pthreads.h or associated library. If you are using gcc compiler then the latest version contains support for c++11 standards.