|
While there's still data in the file
{
Read an arbitrary amount of the file
Loop through the data read, parsing out the words
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
So like this?
while (!eof())<br />
while (fin != '\n')<br />
{<br />
fin >> words[i];<br />
i++;<br />
}<br />
}
|
|
|
|
|
Something like that should work, although it looks like you're parsing lines, not words.
Many stream classes have built-in support for reading lines of text, but I know of none that
parse words.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The thing is I need to read them in from a file. Then check then againest the words before it and place them in a binary tree and if that word is in the tree I need to increament a counter to show that there are 2 or have ever many of that word are in the file.
Cary
|
|
|
|
|
|
led Mike.
thanks so much this is a great help.
|
|
|
|
|
Okay I have a question
const int MAX = 30;<br />
char fileName[MAX];<br />
char name[MAX];<br />
cout << "enter the file name: " << endl;<br />
cin >> name;<br />
fileName = name + ".txt";
My question is when I try and compile this it give me this error.
invalid operands of types `char[30]' and `const char[5]' to binary `operator+'
What is wrong with this code. I was told it is correct however I can not get it to compile.
led mike thanks for the great help on the last problem.
modified on Wednesday, April 2, 2008 3:55 PM
|
|
|
|
|
Cary D. Rutherford wrote: What is wrong with this code.
You can't concatenate char arrays like that in C/C++.
Here's one way you could build fileName:
strcpy(fileName, name);
strcat(fileName, ".txt");
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark. I was told wrong. I thank you for clearing this up for me.
Now it works and I understand.
Thank you again.
Cary
|
|
|
|
|
hi
i have to add the gif file into to my datagrid.
i was very new to vc++ dotnet application. i tried to load gif file like bitmap file, it display the image not the action in the file.
how do i import gif file into datagrid??
thanks in adv
shivapalanirajan k.
iam a software engineer working for varisis technologies bangalore
|
|
|
|
|
I cannot run my application .exe on other pc. Error message like this "The application has failed to start because the application configuration is incorrect. Reinstall the application may fix the problem." But I can open the application on my own pc which I built and debugged the application. What may be the problem?
|
|
|
|
|
Member 4542272 wrote: What may be the problem?
The problem very likely is that you have not fulfilled your responsibility as a developer and read the MSDN Documentation on Deployment for the tools you used in constructing your application. Did I get it right?
led mike
|
|
|
|
|
I am still a student. Every semester I change to use different software depend on the project. Frankily speaking, this is the first time I use visual studio. I do admit that I have skipped the MSDN Documentation due to the time constraint. I just did the coding, built and debugged it to come out the .exe file then assumed that it can be run on same window platform on other machine. Did my answer statisfy you?
|
|
|
|
|
Member 4542272 wrote: Did my answer statisfy you?
Yes, I was right. Now let's recap. You don't have time to read the deployment documentation but you do have time to read the same information if someone types it into a forum message? I suggest you take a course in Logic while at the University, it tends to come in handy while developing software.
Member 4542272 wrote: then assumed
Also you will find that making assumptions doesn't come in very handy while developing software.
led mike
|
|
|
|
|
Ya, I will have time to read it because that is the solution. Let see a scenario: if you are going to have test 2 days later and still have ten chapters not yet finish study, even worse that you no pay attention during lecture, what will you do? As for me, i will hope that lecturer can give some tips or go through past year paper question to get some hints. That is what I am doing.
When I started this thread, I didn't have any clue about the problem. If solution is too long to write in forum, I would just expected that someone give me a direction, e.g, read the MSDN deployment documents. Now I will read it, thats all. One more thing, in my field of study, assumption is important and a course of logic not exist in my university.
|
|
|
|
|
Member 4542272 wrote: One more thing, in my field of study, assumption is important
Ok, good luck
led mike
|
|
|
|
|
Hi everyone,
I've got a problem with dialogs,
After I open a dialog I want to call a function in the parent dialog...
But when I include the parent header file it gives me errors...
Please help me...
Thanks.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
dSolariuM wrote: when I include the parent header file it gives me errors...
What kind of errors...exactly?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
When I include the parent header file it gives the error that says:
"childclass" not declared...
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
Hi,
Please post the code snippet and state in which line are you getting the compile error.
Best Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
<br />
#include "Form2.h"<br />
Form2 ^f=gcnew Form2;<br />
f->ShowDialog();<br />
<br />
#include "Form1.h"<br />
<br />
Error: <br />
syntax error : identifier 'Form2'<br />
error C2065: 'f' : undeclared identifier<br />
error C2065: 'Form2' : undeclared identifier<br />
error C2227: left of '->ShowDialog' must point to class/struct/union/generic type<br />
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
(Hopefully this is the right forum - This is all done in VC++.NET)
Sprinkled Throughout the various project I have are some where, if the design mode window is part of startup, it takes a rather long time for the project to be loaded. Similarly, if already opened, opening the design-mode window take a rather long time. I believe I know why it's happening, but I don't know how to stop it - and it can be very annoying.
Why I know:
1) Projects with database's attached (::SqlClient) are the worst offender - but not all of them.
2) A digital clock custom control I made, when put into a project, was actually ticking merrily away in the design mode window
I conclude that the horrid delay may be establishing (and timing out) of dBase connections.
Does anyone know how to disable this 'live' state of a project that, in my philosophy at least, should not be running?
For now, it's a catch-22: I can re-arrange the code and the items aren't intialized at this point - but that also means they're not on the designer window and that sort of defeats the whole purpose - which is having an open designer window.
Thanks, in advance,
Balboos
Notes: VS2003, VS2005, VS2008 .
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"How do you find out if you're unwanted if everyone you try to ask tells you to go away?" - Balboos HaGadol
|
|
|
|
|
led mike wrote: I can't be sure what that means but if you are talking about your custom control then yes. The designer interfaces include the ability to know during initialization if it is a designer instance. You can use that information to avoid doing any processing that you don't want the control to do in designer mode.
led mike
|
|
|
|
|
Now All I Have To Do Is Hunt This Down this Knowledge - from you comment, I gather it is not a setting.
Thanks for a direction.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"How do you find out if you're unwanted if everyone you try to ask tells you to go away?" - Balboos HaGadol
|
|
|
|
|
Balboos wrote: Now All I Have To Do Is Hunt This Down this Knowledge
If by that you mean read the documentation then yes. If someone has told you can become an accomplished software developer without reading the documentation they told you wrong, don't believe them.
led mike
|
|
|
|