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

I think these people have been watching too much Star-Trek, where the computers run in the future then bring back the result to the present so that it appears to do its stuff instantly.

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

Yes because the compiler can't optimize the code. It also makes the program at least twice the size it needs to be.

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

>> in >> attack;
The line has already been read. So just convert the substr to an int similar to the previous string values attach = atoi(line.substr(weaponDamage.length()+1);

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

>>If you would just give the code I may add up some features
Exact code will depend on the operating system. Setting the time/date is quite simple -- just look up the time functions for the operating system.

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

Ace Flop! The silly conservative have barely finished blaming Clinton for everything and now are starting in on Obama and he is not even president yet.
!

Obama is President by neglect -- someone has to do the job and Bush sure is keeping quite these days. Of course I understand why the Lame Duck In Chief doesn't to anything -- and I'm happy he isn't. He needn't ruffle any more feathers during his final two weeks that Obama will have to clean up.

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

If your husband can't control his urges then he needs professional counseling. Blocking access at home is only a bandaid not a cure. Only professional counseling can provide long-term solutions -- you need it too so that you know how to help him. I don't advocate "kick him out" until you have tried everything else first.

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

When you get errors like that all you have to do is search your hard drive for the file(s), if you find them then add the path to the project like you did with windns.h. If you can't find them, then google for them to see if you can find them there. If not, then you are SOL

In the case of iphlpapi.h, I found it in C:\Dev-Cpp\include directory, which is distributed by Dev-C++ compiler.

Also read this -- you may have to download the Windows Platform SDK, free from Microsoft.

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

Contract your nearest military installation and ask them. If you don't know who to contact then start with the Base Commander's office. You don't have to speak to the commander, but anyone on his staff should be able to point you in the right direction.

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

could Sanjay Gupta be any worse than Joycelyn Elders, who was fired by Bill Clinton

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

If you did your googling then you had to come across this article. It illustrates an array of BSTRs, but the syntax is nearly the same for any POD (plain-old-data) type.

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

1) pass the second parameter by reference using the & operator void foo(char * , char*&); 2) replace malloc() with new

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

that book is a tad outdated
replace <iostream.h> with this:

#include <iostream>
using std::cout;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Then you will have to tell the compiler where that file is at. How to do that depends on what compiler/IDE you are using. If VC++ 2008 Express then Project-->Properties-->Configuration Properties-->C++-->General. and add the path to that file in the "Additional Include Directories" edit control.

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

windns.h should probably be windows.h

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

i have to read two text file
"textfile.txt" and "textfile2.txt"

it only reads "textfile.txt"

how to join the two text and read it.

Open both text files and just read each of them. Only you can answer your question because we have no idea what the hell you are talking about.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
A B C D E F G G F E D C B A
A B C D E F        G F E D C B
A B C D E              G F E D C
A B C D                    G F E D
A B C                           G F E
A B                                 G F
A                                        G

why it donot show spaces between this output

The problem is in vBulletin -- added code tags to correct the problem.

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

you could do something like this:

fscanf(fp,"%s%s%s", List[i].ID, List[i].YR, List[i].lname);
  // get the first name separately because it may be composed of 
  // two or more names with spaces, so fscanf() will not work with this.
fgets(List[i].fname, sizeof(List[i].fname, fp);

Of course you will have to put the above in a loop after opening the file for reading.

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

What has that got to do with the subject of your thread????

Did you try google?

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

Don't know the answer to your question until I know the contents of the text file. Without that knowledge, generally I would use fgets() to read a line, then parse it into its individual parts into the structure.

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

>>for (i=0;i<=(this->Picture->Width/(3*this->cellsize));i++)
>> for (ii=0;ii<=(this->Picture->Height/(4*this->cellsize));ii++)

Don't you realize the program has to make all those calculations on every loop iteration? That's very very time consuming since the value of Width and cellsize do not change during those loops. It would be much more efficient to just calculate them once above/outside those two loops and use the temp variables inside the loop.

As for your problem: I suspect memory corruption somewhere else. Your program has probably done something to corrupt stack, and the problem just happens to appear on the line you marked. My suggestion is to start commenting stuff out until the problem disappears.

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

>>any other ideas will still help
Freaky's solution looks like a sure winner to me :) The only problem I see is if you unplug your computer before properly shutting down the program so the data can be saved.

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

Try putting this inbetween the parenthisis of the 'int main()'

int main(int argc, char*argv[])

and on a line inbetween 'return 0;' and the string, put...

system("PAUSE");

And that should help your problems.

Reasons to avoid system("PAUSE");

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

>>explicit BinaryHeap (int capacity = 0)
capacity a pretty useless variable! It goes out of scope and is destroyed immediately.

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

>>BaseClass ** PointerBaseClass ;
Why does that have two stars? If you want an array of classes all you need is one star. Two stars indicates either an array of pointers to array of classes, or a pointer to a pointer. The code snippet you posted doesn't seem to need either of those. BaseClass* PointerBaseClass = new DerivedClass[size];

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

>>i have tried it but there is no change i got the same massage
What error message -- you never said what that was. Post code and make sure main() is declared like ArkM posted.

Post code if you need more help. And if you are trying to copy binary files then you have to open the files in binary mode, also as previously suggested.

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

you can't open a file like that. fstream only works with files on your local computer. You have to use sockets to send the data to the server, then the server has to have a program that will receive the file across the socket and write it to the server computer's file system.

If the server computer is on the same LAN as your local computer then you can just map a drive to it and use the drive letter like you do the c: drive letter.

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

you need to post code so we can see exactly what you are trying to do.

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

copy the string one character at a time into another variable that is long enough to hold the extra characters. When an '\' is encountered just copy two of them.

But I have to question your reason for doing that. When you type a path from the keyboard into a variable you don't need the couble '\' characters. They are only needed when you use string literals in your program because the compiler has to interpret the characters.

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

Should I trust this external site?

I only opened the second link and didn't have a problem. Its just the source code with line numbers. It would have been a lot better, and safer, had he just attached the files or posted them directly here.

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

post all new code so we can see what you have done.

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

line 383: copying 1 too many bytes because currentSizeOfS has already been incremented by 1 to account for the null terminator.

line 400: The s pointer was passed by value, nor by reference, so allocation additional memory here only has scope in this function, not the calling function. Just delete this line because the calling function has already allocated the memory and all you have to do is copy the string in originalContentOfs back to s, as you are already doing on lines 406 and 407.

I see there are other instances where s is being reallocated -- those lines will not work either for the same reason as line 400.

How to correct: pass s by reference so that memory allocations will be reflected in the calling function int dtioEdit(char **s, int row, int col, int len, int *ppos) Not the double star.

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

vector of strings are a lot simpler, and safer, than array of charcters because you don't have to worry about memory allocation and deallocation. You also can avoid standard C functions such as strcpy(), strcmp() etc. Just a simple = and == operators will do the trick, just like you use with numeric variables.

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

configuration files are just plain-ordinary text files, so just use ifstream to read them. There are several ways to format the file, one way is in the form <variable name> = <value> . For example:

UserName=John
Password=xxxyyy
Age=18
Address=101 Any Street
City=Anytown
State=Illinois
Country=USA

The list of items in the file is endless, completely dependent on your program.

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

Try a slightly different algorithm

void voorkomentellen ( vector<int> getallen , vector<int>& getelde_rij, vector<int>& voorkomen )
{
	unsigned int i, teller; 
	int getal1, getal2, count=1;
	getal1 = getallen[0];
	for (i = 1; i < getallen.size( ); i++)
	{
		getal2 = getallen[i];
		if (getal1 == getal2)
		{
			count++;
		}
		else
		{
			getelde_rij.push_back(getal1);
			voorkomen.push_back(count);
			count=1;
                           getal1 = getal2;                       
		}
	}
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

post code

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

iomanip.h is c++, not c, so you should delete that line (line #4)

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

[edit]^^^ beat me to it:) [/edit]
>>fscanf(inFile, "%s", text)
>>printf("%s\n", text);
I don't know why the file doesn't open, but the above line is guarenteed to crash. Why? Because "%s" tells scanf() and printf() the next argument (text) is a null-terminated character array, and all you passed is a single character. You can fix that problem by declaring text something like this: char text[255]; As for the problem you reported, try entering the full path to the file. But you have to increase the size of FileName so that it can hold all the characters.

Finally, never ever use gets() because its so unsafe. Use fgets() instead like this: fgets(filename, sizeof(filename), stdin); Now the drawback with fgets() is that it will append the '\n' (Enter key), so you have to strip it off before using the filename variable.

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

The case statements are irrelevent -- they do absolutely nothing, so you should just delete them.

if(TFGame.ToggleWarhead == true)
               {
			SMNameArray[0] = "Shield (50/30)";
			SMIndexArray[0] = 1;
            		SMNameArray[1] = "Protector (200/30)";
			SMIndexArray[1] = 2;
			SMNameArray[2] = "Portal (200/30)";
			SMIndexArray[2] = 3;
			SMNameArray[3] = "Armory (200/60)";
			SMIndexArray[3] = 4;
			SMNameArray[4] = "Generator (300/60)";
			SMIndexArray[4] = 5;
			SMNameArray[5] = "Outpost (600/90)";
			SMIndexArray[5] = 6;
			SMArraySize=6;
           }
	    else
          {
			SMNameArray[0] = "Shield (50/30)";
			SMIndexArray[0] = 1;
		        SMNameArray[1] = "Protector (200/30)";
			SMIndexArray[1] = 2;
			SMNameArray[2] = "Portal (200/30)";
			SMIndexArray[2] = 3;
			SMNameArray[3] = "Armory (200/60)";
			SMIndexArray[3] = 4;
			SMNameArray[4] = "Generator (300/60)";
			SMIndexArray[4] = 5;
			SMNameArray[5] = "Outpost (600/90)";
			SMIndexArray[5] = 6;
			SMNameArray[6] = "Warhead (3000/180)";
			SMIndexArray[6] = 7;
			SMArraySize=7;
             }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you want any responoses you need to state the compiler and operating system you are working with.

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

You can design the text file any way you want to, unless you were told otherwise. What you posted will work. Another common method is to sepate fields with a comma, assuming a comma does not occur in the book name or other fields.

BillyBob, CAL 123.45

And you use ifstream for input. ofstream is only for output.

[edit]What ^^^ said works too :) [/edit]

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

>>but the binary flag set the file isn't opened
Then there is something else wrong, such as incorrect filename passed to that function or the file is not in the directory you think it is in. Add the full path to InputFileName and see if that works.

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

According to this, you are right :)

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

Happy New year!
I am prepared for an all-nighter!

You're just a tad bit late for 2009 :) Or are you working on 2010 already ?

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

There are several ways to do it. One way is to use c++ stringstream class. And don't use printf() in c++ programs, it will work, but iostream is more suited to c++.

#include <sstring> // stringstream class

int main()
{
    int x;
    string y = "1234567890";
    stringstream str(y);
    str >> x;
   cout << x << "\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

As you probably already guessed, you don't do that with a bunch of if statements.

I guess you already have a list of books with their titles and call numbers, maybe other information too. In that case, all you have to do is code a loop that searches the list of books. If you have them stored on disk in a file then use fstream to read each book and compare the book name with user input.

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

OMG that must be incredibly sloooooow -- calling seek for each character! A much quicker, and more reliable, solution would be something like this:

unsigned char inData;
while( FileHandlerFile.read((char *)&inData,1) )
    DataHexArray.push_back(inData);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I would have thought it wise to have read the chapter before doing the extercises at the end of the chapter :)

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

We have an entire sticky thread devoted to books which you will probably want to read.

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

Happiness -- over 65 and working because I want to not because I have to.

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

Happy New Year everyone :) I didn't bother to stay up that late -- went to sleep at 9:45 pm because I have to be at work bright and early this morning.