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

>>The compiler builds it and the output is ok
Yes the compiler will build it, but its not ok. What you have is called buffer overrun. Look at what you posted and THINK about it for a couple minutes. Why do I say buffer overrun -- because array element at indices matrix[NO_OF_ROWS][NO_OF_COLUMNS] does not exist. Your program is scribbling all over memory outside he boundries of the array.

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

The code in lines 16-20 is all wrong. you need nested loops to do that, and array indices are the values of the loop counters, like this:

array[row][col] = 0;

Or even easier -- you don't have to do the above at all if you initialize the array when it is declared

int matrix[NO_OF_ROWS][NO_OF_COLUMNS] = {0};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm not a MAC user but it sounds like the data file is not in the same directory as where your program is running. Try putting the full path in the open statement, like this: Note: I don't know a thing about MAC file system so I'll use MS-Windows and you can translate to MAC

inData.open("someFolder\\input.dat");
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I can't read your mind -- post most recent code that includes the changes we have already discussed. I'm not going to repeat myself, so re-read all previous posts to this thread if you need to. If what we have suggested doesn't work then post the code you tried. Don't guess -- do copy/paste.

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

you don't need turbo debuger to view the disassembled program. Every version of MS-Windows since MS-DOS Version 1.0 comes with a free disassembler named debug.exe (located in c:\windows directory). At a command prompt cd to the directory that contains the *.exe program then type this:

c:> debug someprogram.exe <Enter>

debug.exe will load and disassemble to program then display a > prompt. type ? and it will display help. type u and it will disassemble the program. You can even execute the program , set breakpoints, and step through the program one assembly instruction at a time with debug.exe.

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

if you can help me please change my code as requirment , if you can not do i will get help from www.cramster.com , cramster experts can do everything,

Yes they are very good too. If you want someone to do your homework then bye, you won't hurt my feelings. :)

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

you need to do that in a timer interrupt service so that the service gets called every clock tick. Then inside the service function you need to keep track of the most reent time the color was changed and compare that time with the current time. If 5 or more seconds have elapsed then change the color again and reset your time counter.

The newkey interrupt service you wrote only needs to check if the 'Q' key was hit, and if it has then uninstall both interrupt services you have installed and uninstall the TSR.

None of the above are trivel things to write and will require some research on your part how to do them.

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

What operating system are you using? I might be wrong but I don't think TSRs work with MS-Windows command prompts because they only emulate MS-DOS.

>>Please sir i can't do
Narue is a woman. And just because you can not do something today doesn't mean you have to give up trying. Search the internet and visit your local bookstore. Or better yet if you are taking a class then study your textbook. But no one here is going to just give you all the code. Learn to reasearch the problem.

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

I'm glad to hear it turned out all right for Montanez. Maybe the decision will set a precedence that the law is rubbish.

>>The American Civil Liberties Union vowed to sue, saying it's a superficial fix that ignores the city's homeless problem
I normally don't like the ACLU but in this case I think everyone in the world will support them.

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

>>I tried both (using fsetpos without fgetpos and using the former with the latter).
Post code, I can't see your monitor from my home so its not possible to help you.

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

>>Can anyone point me in the right direction?
Yes, take programming classes at your local college. I know that isn't what you wanted to hear, but that really is the best and quickest way to learn the language(s).

And get a bachelor's degree if you want to make programming your profession.

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

just output the character as an integer, you might have to typecast it depending on what functions you use to display it.

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

I use IE7 and sometimes they work and other times they don't. I like the list of smilies to appear above the edit box. When I do see the list it is located just to the right of the text Post Icons just below the bottom of the edit box. I have to scroll the window up to see them, which is inconvenient.

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

Heh. You come by this gem with experience?

I may have snow on the roof but I'm not dead yet :)

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

Set an event handler for WM_CLOSE event, then you can do whatever you want in that function.

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

If that file contains variable length strings then you can not read it with just one read statement. You will have to devise a more complex algorithm to read the file. Exactly what algorithm depends on the file's contents, that is, how was that file written.

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

is that correct?????

No -- Narue lied to you. :)

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

>>mathid[10] the array starts with size[5].when an array wants more memory it must renew it self and ask more space.

You can't dynamically expand the array size when it is statically allocated like you posted in the class. You will have to make mathid a pointer if you want to change its size at runtime.

Or better yet, since this is a c++ program using std::string instead of character arrays. The string class will do all the messary memory allocations for you, simplifying your whole program.

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

I don't know what you mean. the replace method does not have the correct number of parameters. See these examples, code snipped below

// replace characters of tooth string with num (here length) 
  // characters from teeth string, beginning at index 21
  string tooth = "He ate it all with a toothpick";
  cout << tooth << endl;
  string teeth = "teethpick";
  tooth.replace( 21, teeth.length(), teeth );
  cout << tooth << endl << endl;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

use the standard tolower() function (sometimes its a macro) to convert a character to lower case and it will work on every compiler's implementation

b = tolower(b);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Look at my code below and tell me what i'm doing wrong.
the code you posted contains some syntax errors and missing semicolons.

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

It was fixed. Then it wasn't again. I'm still investigating exactly what is causing the issue. It appears that before the problem only affected FireFox but was fine in IE. Now the problem is only affecting IE and is fine in FireFox, from what I can tell.

Did you ever get around to fixing this problem? I still can't see the list of smilies most of the time. When I do see it it is located almost at the bottom of the window.

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

well, when you get around to posting something that includes the fix that I last mentioned I might get around to answering you. In any event -- to late for me tonight, going to sleep. Good night. :)

AD

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

We've all heard about people having guts or balls.
But do you really know the difference between them?

In an effort to keep you informed, the definition for each is listed below...

GUTS - is arriving home late after a night out with the guys, being met by your wife with a broom, and having the guts to ask: "Are you still cleaning, or are you flying somewhere?"

BALLS - is coming home late after a night out with the guys, smelling of perfume and beer, lipstick on your collar, slapping your wife on the butt and having the balls to say: "You're next."

I hope this clears up any confusion on the definitions.

Medically speaking, there is no difference in the outcome since both ultimately result in death

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

There are two problems with your program.

1. Move line 15 down to just after line 17 -- it needs to be inside that loop.
2. don't use variable name flips at lines 15 and 18 because that destroyes the loop counter. use some other variable name.

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

looks like that is what your program already does. What makes you think it doesn't work right ?

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

you obviously ignored my previous post so I'll ignore yours.

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

You've tried to fix what ??? There are only two choices -- heads or tales -- 0 or 1. what else do you want?

[edit] Ohhhh, I think I see the problem. after getting user input you immediately change it to either 0 or 1. Delete that line. [/edit]

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

that while loop is close to being ok, but not quite. If the word is found you need to jump out of that loop if you don't then the if statement that is after the loop will not work correctly.

That loop is also still incorrect because the return value of find could be somewhere in the middle of the string, which is not what you want. For example, lets say the word you want to find is "Mary" and the sentense is "Hello my name is Mary.". In this example the find method will return a value of 17 because "Mary" starts in position 17 of the string. But you want a string with the word "Mary" at the beginning of the string and ignore other places. This means that if statement has to be changed to check if found is 0, not npos.

while(getline(dict,line)){
    if ( (found = line.find (word, 0)) == 0 )
    {                                      
          cout<<"\n"<<line<<endl;	
          break;
     }
}

to convert to lower-case you need to call tolower() in a loop and call it for every letter in the word. There is another way, assuming word is std::string object and not a character array.

translate(word.begin(), word.end(), word.begin(), tolower);

You will also have to do the same thing with each line read from the file, just to insure that they are all the same case.

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

Since this is a C question and not C++ I'm moving it over to the C board.

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

>>but it doesn't want to work
by that I guess you mean it will not compile. What are the compile errors? What lines won't compile?

I know for a fact that lines 38 and 40 are wrong. -- using << instead of >>

also purchase and payment variables should probably be floats not ints

Another obvious problem -- you did not prototype function change(). It must be prototyped at the top of the program if you call it before it is coded. Just like variables have to be declared before used, functions have to be prototyped (or coded) before called.

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

re-post your most recent code. What you posted earlier was not right, as I mentioned before. Pay close attention to the placement of the braces. compilers do not accept sloppy coding.

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

I just tried it and got all the way to the end where it asked for credit card info, then I stopped because it would have cost $8+ for USP

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

maybe the prosecuter is taking it to court as a test case to see if the law can be declared unconstitutional.

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

looked like most of those resulted in serious injuries or even death. But I like the alligator trick because anyone stupid enough to stick his head in an alligator's mouth diserves to get bit. And the guy who thought he was superman and attempted to jump from one rooftop to another -- and missed.

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

Very good sound effects too! Let's give a plus mark to Ancient!

Sorry, that's not my handiwork -- I just found the link.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Dave Sinkula commented: Made me laugh. +11
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{
	string line;
	char* word="";
	size_t i;
	fstream dict("c://example.txt",ios::in);

	if (!dict.is_open()){ 
		cout << "Unable to open file \n";
		exit(1);
	}
	cout<<"Enter word to search \n";
	cin>>word;
	{
	while(getline(dict,line))   //read line by line
	i = line.find(word);    //try to find the var word in the string line an assign it to i
	
	if (i!=string::npos)      // dont exactly know what it does
  cout<<i<<" not found";      
	else 
		line.compare(word) != 0;  //compare the string line to the var word 
    cout << "result " <<line << endl;
	exit (1);
  
}

	return 0;
}

I know youre trying to make me understand but am a little lost here really !!
i put comments around the lines to see if i understand what each does correctly , please correct me if am wrong..

thanks a lot

you put the braces in the wrong place. This is how it should look:

while(getline(dict,line))   //read line by line
{ // start of while

    // your code goes here

} // end of while
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

read the INSTALL file and it will tell you that they used VC++ 6 and NASM assembler.

2.a/ Requirements.
------------------

- MS VisualDev 6 Processor Pack 5 or MS VisualDev 7
- nasm installed as 'nasm' in the msvc binary search paths.

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

you can not use signal.h and msg.h at all -- not supported by any MS-Windows compiler I know of. Then remove the sys/ from the others. occi.h have no clue. What you have left is this:

<time.h>
<stat.h>
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

They all are coded the same way, pick one and you have all the others, just change the operator

int operator=(<parameter list here>)
{
  // blabla
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This will disable the button CButton->EnableWindow(FALSE) .

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

A little off. First you need to put braces around that entire while statement. Next, the find mentiond returns string::npos if the word is not found. You need to add a check to see if the find method worked or not.

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

expand the while loop to extract the first word (hint: use string's find() method to locate the first space), then compare that with the string that you entered from the command line. If they are the same then you can stop that loop.

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

yes -- read each line sequentiall from star to finish until you get the line you want. use fstream's getline() to read an entire line then check only the first word to see if the line is the one you want.

Don't attempt to code all of that at one time. First get your program to open the file for reading. After that is code and compiles without error, add a loop using getline() to read each line. Get that working then code the next part.

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

Ok -- now lets see YOUR code to implement all that.

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

See, now I've learned lots of new things today (quess how I chose my screen name?).

I just compiled/ran my sample code snippets and am happy to confirm that AD was correct in all respects, as usual, though I would gladly have bet a beer/cola/lunch at McDonald's to the contrary earlier. Thank you for not rubbing it in too hard.

I also want to thank Narue for her explanations; very informative, as usual.

Great. We all learn new things occasionally. Its when you stop learning that you want to start worrying :)

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

I see its now been 8 days since you originally made this thread and thankfully still have surviced (not killed yourself) :) I assume that was just an exaggeration -- would you like me to change the title of this thread ?

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

I think you can also order the SDK on CD at nominal cost, probably $5 to $10.

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

>>User will enter first name followed by one or more spaces and then the last name

You can not do that with cin >> fullname; because cin will stop reading from the keyboard at the first space, which is not what you want. User getline() to change that behavior, like this: cin.getline(fullname, sizeof(fullname)); [edit]as vmanes said ^^^^[/edit]