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

already got it working. thanks

Great :) See that wasn't so hard was it ?

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

Neither of those functions will be useful to you. This is a c++ program, right? Then just use std::string's find() method after reading a line from the file

Here is a complet list of std::string methods.

#include <string>
#include <fstream>
using namespace std;

int main()
{
    string line = "Once upon a time there were three little pigs";
    string search_text = "were";

    string::size_type pos = line.find(search_text);
    if( pos != string::npos)
    {
         // found it
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I vote for google too. Never used yahoo but I doubt it can beat google's search eigine for speed and number of links. Of course on the otherhand who realy need 100 million hits for a simple question ?

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

you could do a remote login on the remote computer, assuming you have a user name and password on that machine. I've seen this done by network administrators at my old office, but I don't know exactly how they did it. I suppose another way is to use PCAnywhere by Symantic.

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

line 13: If that is executed the next line should be exit(1) to prevent further program processing. No point continuing when the input file doesn't exist.

lines 26 and 40: delete both these, only one is needed. See the while loop I posted below for correction.

linet 25: don't use a for-next loop for this but a while statement that just reads the entire file regardless of the number of lines in it. Since your not allowed to use arrays there is no point using any sort of index counter.

while( in_stream >> store )
{
   // blabla
}

The next thing you need to add inside that loop is test if the current value of store is less then the previous value read. If it is less then the file is not in ascending order. You already have part of this on line 28, but what you are missing is to set input = store; after the test on line 28 to get ready for the next loop iteration.

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

That's not a question -- its just a statement of your homework. You posted code, so what do you want to know about it.

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

add cin.ignore() just before the return statement to make it stop until you press a key.

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

goto www.amazon.com and search for "Visual Studio 2008" in the books selection. They have several of them with reader reviews too. If there are any graphics books they will have them too.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Salem commented: Yeah, it was rhetorical :) +15
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'll repeat myself -- you did not include the <string> header file -- or at least you didn't show it in the code you posted.

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

That is C code you posted, not assembly. If its a C program you are writing then you are in the wrong board. Let us know which is it and one of the mods will move this thread for you into the right board.

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

did you read the article I posted? did you download the DDK ?

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

what is MR ?

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

by WMI I assume you mean this ? Read the article and it will tell you what you need.

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

Ok, nice code, but what is your question?

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

The functions you call are probably attempting to access that memory location because of bad arguments you send it. Check the value of pointers such as p_dx_Device to make sure they are valid and the value of the parameters sent to make sure they are correct. for example what is the value of int_VertCount ? Is it a valid value ?

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

>>I'm not able to respond to your posts lately
What posts are you talking about ? I don't get emails at all (normally) and I respond to posts all the time. Its pretty easy to find the threads you have participated in.

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

I agree that would be a nice added feature. There are several menus that this would benefit.

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

I think you get a couple rep points for every 1,000 posts. As far as I know there are no rep points based on length of membership. Post frequently in the technical forums and your rep points will probably go up faster.

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

The problem is that government gets the majority (72%) of the money. So the government is "the rich."

maybe you should have surrounded that with [sarcastic] [/scrtastic] tags because we all know that isn't true -- at least in our country.

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

post the code you know how to do then we'll talk about the rest.

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

>>error C2679: binary '>>' : no operator found which takes a right-hand operand of type
>>'std::string' (or there is no acceptable conversion)

you forgot to include <string>

line 30 of the code you posted: the iterator iter has never been set to anything, so that loop won't work right.

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

With the MSDN subscription you gets 40-50 DVDs (or so) that contain every operating system Microsoft has ever released and in every language (English, German, etc) as well as C++ compilers, device drivers, DDK, Windows SDK and searchable documentation for all win32 api functions.

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

You can boot from any bootable drive -- master, slave, CD, or DVD, and in some cases even the A and B floppy drives. But the first hard drive installed is always the master driver. All other non-removable hard drives are slave drives. You might damage your computer if you turn it on with only a slave drive.

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

No it doesn't make sence. What compiler are you using ? No compiler in the world would have given you a clean compile with those errors in it. You just did not pay any attention to the errors your compiler gave you.

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

My program works properly under windows, however, it seg faults when I try to compile/run it under linux.

So, how did you get the executable program when there were compile erorrs? No respectable compiler produces the executable under that condition. Do you not look at the messages your compiler produces?

But, like I said, it does work under Windows, just not Linux.

The exact same code ? Is yes, then its impossible you could have gotten a clean compile.

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

Learn about win proc in this tutorial. But you probably don't have to worry about them until you start learning MS-Windows GUI programming.

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

>>I just dont get any of it
Sometimes it just takes awhile for things to sink in. Maybe you need to restudy the material in your textbook and to all the problems at the end of the chapters.

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

a flag is just an integer whose falue is either true (1) or false(0). So create an int and set it to false before the inner loop starts, them if a swap is made set it to true. After the inner loop finishes check the value of that int and if it is true then break out of the outer loop.

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

line 24: Performance can be improved as shown below. The outer loop goes from 0 to number-of-elsmenets -1, its not necessary to look at the last item. The inner loop starts at i+1 and continues to the number of elements.

for(int i = 0; i < 9; ++i)
{   
     for(int j= i+1, j < 10; ++j)
     {
           if( numbers[i] > numbers[j])
           { 
                  // swap needed here
            }
    }
}

For the second question, just add a flag to indicate whether or not any swaps were made during that pass. If not, then no point continuing because the array is already sorted.

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

>>We don't do it for you. Period.
Not so fast Nurue. I'll do it is the op first deposits $10,000 USD into my PayPal account. But then this thread will have to be moved to the Job Offers board. :)

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

no -- the rc file is compiled and attached to the *.exe. If you need to change one of the resources in it during runtime you will have to make in-memory changes.

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

name is just a single character. What you want is a character array. char name[255];

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

a mischaracterization

the first thing the democrats did when a tax rebate was proposed as a way to stimulate the economy was complain that the poor (who do not pay taxs) will get nothing.

I don't think those tax rebates will be as helpful as Bush thinks -- most people will just use it to pay off existing bills or buy something made in China. Hows that supposed to create new jobs in the US ? A better solution I heard is for the feds to spend the money to repair our ageing interstates (autobahns for you european folks) and bridges -- US jobs, US employees, US concerte and US steel. Now that would do far more to stimulate our economy then buying Chinese made toys to stimulate the Chinese economy.

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

But, then again I suppose if the extra terestrial pilot is of a certain gender it is well known they often can't identify their vehicle beyond it's colour. .

Must be referring to me. I only bought my car because of its color; I always buy yellow cars :)

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

and then wherever you include this file, do it like this


#ifndef PERSON_H
#include <person.h>
#endif
this will ensure the file does not get included more than once

Yes it will, but its unnecessary when person.h includes the code guards. We never do that with standard include files such as <string> so why do it with your own header files.

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

Several ways to achieve that. Read this article

shaikh_mshariq commented: Helped a lot +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

just create a console or a windows application and you have everything you need.

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

It is easier to use std::stringstream class to do that

#include <sstream>
<other includes here>

...
string sentence = "Once upon a time there were three little pigs";
string word;
vector<string> array;
stringstream stream(sentence);
while( stream >> word)
{
    array.push_back(word);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

see these winsock tutorials.

MFC has a socket class, but it sucks pretty badly. Better to just use winsock functions directly.

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

That's Fawlty Towers, not Ivory :)

You're right -- its halarious anyway. Its been several years since I have seen it. Get it once in awhile on BBC America TV channel.

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

You apparently created a Windows application, not a Console application. The easiest correction is to start a new console project then copy what you have done into it.

And your program must have a main() function.

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

The only one I really really dislike is Hillary -- the spectical she and Bill made of themselves in SC was just awful. How many Clintons are running for President anyway? It looked like they were both running. Bill Clinton has had his 8 years and should now keep his big mouth shut.

BTW: I really like your avator too -- very artistic looking.

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

what operating system will this program run on ? and what compiler are you using. I guess there is probably something else such as another thread that does something with P1 to make the LEDs change.

Do you have an os-function similar to sleep() and Sleep() available ? Loops are a terrible way to implement a delay function.

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

I think the problem is line 21 of the header file -- you have to have a semicolon at the end of the class. Put a semicolon after that closing brace.

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

John Edwards is a snake-in-the-grass. I wouldn't vote for him for city dog catcher.

>>Getting rid off of another Democrat
There are no republicans that are worth voting for. That only leaves "The Witch Hillery" or Obama. There are a few other minor political parties but none are electable.

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

The default to open() is to truncate the existing file and start anew. To append to the file add the ios::app flag. myfile.open ("example2.txt", ios::app); Read this for a complete list of the flags you can use in open()

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

You might read this, especially the comments at the end of the window about SendMessage command-line function. I don't have Outlook on my computer so I can't test it.

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

what's the significance of those delay functions? What is P1 because it isn't defined anywhere in the code you posted.

for case G:

int a1 = 0x01;
for(int i = 0; i < 8; i++)
{
    P1 = a1;
    a1 <<= 1;
    delay();
}

or you could create int arrays to hold the values for each case.

What compiler are you using for this?

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

>>Unfortunately, it is impossible to use a window proc on the console window
I just tried SetWindowLong() to hook into the WinProc inside the os, but it doesn't work. According to MSDN

Windows NT/2000/XP: You cannot change this attribute if the window does not belong to the same process as the calling thread.

I've used SetWindowLong() several times successfully on Mobile 5.0 and PocketPC applications to hook into windows that were not part of my process (no console windows). But I guess that's a feature of those operating systems that doesn't exist on desktop windows. Too bad because it could be useful.