WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Would you care to explain the problem?
Explain == good description with plenty of details
Explain != vague description with no useful information

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Nope, don't see a thing. You might want to get to know the debugger.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Yes, that's what I meant, since it was wrong.

And since your description of the problem is vague, I have no other idea. Describe in detail and post you current formatted code and we'll try again.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Look carefully at your IF statements. Are your comparison operators correct?

Also, format your code. you'll need to if you want to keep posting because if we can't follow your code, we can't help.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Of course it's possible. How can you keep track of the receipt number?

Why are you starting a new thread? Did the other one get answered?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Have you ever heard of wine? That should do trick to run windows exe in linux :)

Did I misunderstand his question?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

The executable files in these systems are different. They follow the conventions of the OS. That is why they are not interchangable.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

#1) Use better variables: PswdIn, Pswd, Name, NameIn would be much better.

#2) Display the values before the IF statements to make sure they are the same.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Also try formatting your code. With code this large, your inconsistent formatting makes the program almost impossible to follow.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Care to supply some details? Or are we supposed to guess?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

... being in the UK, the trains where I am are late so often, that if you miss it it's your own fault :D

Then it seems that if the trains are late so often, the entertainment value of Musical Platforms would be welcome. Especially if accompanied by dancers...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Would you care to explain what makes you think it's not working? Or should we guess?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Gee. You just aren't into progress, are you? :icon_twisted:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

The highlighted part below is where the function located...Is there any problem with the input?

I don't know. Does it work?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

:icon_rolleyes:

If you don't know C, you can't. Isn't that obvious?

Search for a C tutorial and start learning..

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
do
        {
            condition = fgets(save,30,reading);
            printf("\n%s",save);
        }while(condition != NULL);

When you read the last part of the file, condition is not NULL.

It doesn't become NULL until you try to read after you've reached the end. Now you have an error. But you output the last stuff read again. Then the loop exits.

You need to figure out how to exit when you get the error, not after.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Do you know C?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Details, details, details. Care to give us some?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

No, since you didn't bother to tell us anything. The code does exactly what you told it to do, so it's working.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Convert that pseudo (VB) code into C code.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Of course.

Create an array of your structure.
Open the file.
Read 3 lines into fname, lname, salary for person 1 (index 0)
Read the next 3 lines into fname, lname, salary for person 2 (index 1)
etc.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Good first post! Good title, Code with tags, mildly useful description. All in all, a great first effort.

Unfortunately, you didn't post the entire error message. Also didn't mention what line the error is on. I don't see any lines that would have that error, either. Please add a few more details and we're in business.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

If you seriously want to report a misbehaving ad, post in the DaniWeb Community Feedback forum. If you're just complaining, I'm with you, man!

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Look at the MsgBoxStyle.xxx value from the parameters and show the buttons specified.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

don't do it with a stack you are typing too much...
use recursion very powerful and easy to understand.

Just because you learned recursion recently and it looks kool, it is rarely an acceptable alternative to a loop. Way too many resources are used and you can crash your computer.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What serial number? How is it formatted? How does the subroutine get it?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Hi,
it opens the file by a native method after loading it...

SHOW US THE F'ING CODE! How many times do we have to ask?!?!?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Nice details of the problem. I understand exactly what and where based on you extensive explanation.

Answer:
Maybe you coded it wrong. But I'm not searching through 262 lines of code for the one that might be wrong. Maybe you could help by giving us details? Line numbers? What actually happens?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

No, you cannot use fread . The proper answer to gerard4143's question was "text", althought the proper question should have been "Is the file a binary or text file?"

Without knowing what actually happened using fget (whatever that is) we can't really tell what you did wrong.

Maybe you should try to explain the entire problem you are having since we aren't at your computer watching over your shoulder.

Details == understanding.
Vague phrases == guessing (and usually wrong, too)

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

kdcorp87, use the preview button once in a while....

i have been told to use a do while loop instead of a goto statment,

That is an excellent suggestion. Although in some cases a while loop would work, too.

but when i run this program it goes through every loop
i understand that even if it did work properly it would be a infinate loop, so next question is how do i exit the do while loop?

Um, yeah...? Code goes from statement to statement. If you have loop after loop after loop, the code executes each loop. Why are you surprised at that?

To break out of a loop, change the value the loop is using as an exit condition to make the while fail -- a comparison yielding false .

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Use in-code documentation.
Pay closer attention to what you are doing.
Think before you type.
Remember your program's structure.
Take notes.

Take your pick.

Actually, pick them all. And heavy on think. That's what the brain does best.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

No. That's your job. When I was a beginner I had to modify my own code.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Posting two threads on the same topic is not allowed. Please reread the Member Rules.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Rather than outputting true/false in the loop, set a flag to true before the loop. If any values are not in order, set the flag to false. When the loop is over, output the result.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

How do you open a file now?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

But I am not able to understand that when I try to read from the file when the get pointer is at the last byte (or somwhere there) of the file then why does it read the last data element entry full. I meant that when the get pointer has already traversed the last entry then why is it travelling back a few bytes to read that again. Please explain???
And sorry for the late reply...

We don't care how late your reply was? We weren't waiting for it, believe me. :icon_wink:

See this about your .eof() question. feof() is identical to .eof().

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Thanks
I want this funcion to print "true" (just once, not for every element )if the array is in a ascending order

How does that post come close to explaining:

You need to tell us what you wanted, what the code is doing, and what the code should have done. Details. Examples.

I see one question answered. Two unanswered. No details. No examples.
You've fail to supply requested info, and you expect worthwhile help?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You watched the Mercury space shots live and were old enough to understand what was happening

Ouch....

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Is there any way to make it so newbies and problem posters are blocked from posting until they either read/reread and sign off on rules page just like signing off on user agreement before continuing to install software.

When was the last time you actually read a user agreement? You can't actually force anyone to read the rules.

But if they need to sign off on them before posting as you suggest, at least we now have definite recourse to slap hands. They can't complain about being reprimanded.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

That's not at all what I said. Reread. I said "display each character [of User and File input] before the IF statement?" That suggestion is simple, to the point, and does imply new variable(s).

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Wouldn't a question to the folks that wrote the code yield better and faster answers? Just a thought...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

And what did the user enter. Exactly.

Look at each of the characters in the user input and the file input. You may find they are not the same. Display each character before the IF statement.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

there is no reason for:

Enter artist name: Grateful Dead
[B]Another artist? [/B](y,n): y
Enter artist name: Lucinda Williams
[B]Another artist? [/B](y,n): y
Enter artist name: Third Eye Blind
[B]Another artist? [/B](y,n): y
etc.

If the artist is not entered, assume that is the 'no'. All you need to do is check the number of characters entered.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What if the Queen is overthrone beforehand? Hmmm?

Is she a drinker? Maybe she'll be underthrone.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Bad formatting, non-standard code.

Basically a bad post.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
void search(ofstream &outFile, ifstream &inFile, int ID)
{
	int id_num;
	string name;
	char userreply;
	char lookagain = 'Y';
	string inputname;
	

	while (!inFile.eof() && (lookagain == 'Y' || lookagain == 'y'))
	{
		inFile.seekg (0, ios::beg);
		inFile.getline(file);
		if ( ID == id_num)

What is the value of id_num?

And see this about .eof()

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

:icon_rolleyes:

Did the program give you correct output? If no, it's definitely wrong. If yes, it might be right.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

If you are going 60 miles/hour, what is the miles/minute? What is the miles/second?

Can you answer these without a program? Just pen and paper?

If so, post the answers. If not, look up the equations and figure it out. This is the first step to programming the solution.

And what is spm? Seconds/minute? Seconds/mile? And when I said "tell us what the problem is" I meant start from teh top. What are you trying to do, what values did you expect, and what did you get. Details.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

So output the proper number of spaces before the *s

You can obviously output the *s, just do the opposite for spaces.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Thanks for what? If you have a problem you need to explain what that is.