473,545 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Error: Could not find a match for" is the bane of my existence right now

9 New Member
Hello,

I am trying to write a program that opens a file; reads through it; outputs the text; then outputs the number of lines, words, and characters.

Problem is, every time I try to compile, no matter what modifications I make, I get an error, "line 42: Error: Could not find a match for std::basic_istr eam<char, std::char_trait s<char>>::get(i nt)."

I have tried everything I can think of. Help?

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

int algorithm(void) ;
int code(string);
int initialize(int& , int&, int&);
int processBlank(in t&, char&);
int copyChar();
int printTotal();

int main(){

char ch;
string word, line;
int lcount, ccount, wcount;
int initialize();
// algorithm(); USED IN BUILD FILE
// code("text.cpp" ); USED IN BUILD FILE
ifstream inFile;
inFile.open("/export/home/wyatt/public_html/!Data/simple.txt");
processBlank(lc ount, ch);
inFile.close();
cout << "Lines: " << lcount << endl;
return 0;
}

int initialize(int &lcount, int &ccount, int &wcount){

lcount = 0;
ccount = 0;
wcount = 0;

return 0;
}

int processBlank(in t &lcount, int &ch){

ifstream inFile;
inFile.open("/export/home/wyatt/public_html/!Data/simple.txt");
while (! inFile.eof()){
inFile.get(ch); <---------------- Line in question
if (ch == '\n'){

lcount++;
}
}
return 0;
}
Feb 23 '08 #1
2 5877
weaknessforcats
9,208 Recognized Expert Moderator Expert
inFile.get() requires a char&. You do this inside processBlank() but the char& is passed in as an int&. Hence, the error.

Change processBlank() to have a char& argument instead of an int& argument and off you go.
Feb 23 '08 #2
Sejoro
9 New Member
Ah. Of course. How stupid of me.


Thanks.
Feb 23 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
13259
by: Jay Chan | last post by:
I keep getting the following error message when I run a serie of SQL commands: Server: Msg 9002, Level 17, State 6, Line 15 The log file for database 'tempdb' is full. Back up the transaction log for the database to free up some log space. I have tried "dump transaction tempdb with no_log" right before I run the SQL command. But that...
3
1409
by: Gary McGill | last post by:
I have a C# solution with a dozen or so projects. There are references between the projects, and these were all added as "Project" references. Everything's been working fine for months, but suddenly today it all collapsed in a heap. I get a mysterious error when running the project: "The located assembly's manifest definition with name...
4
34576
by: Saso Zagoranski | last post by:
Hi! I have a little search textbox, which goes through a dataset as the user types in the textbox... If the user types "1", then all the fields beginning with a 1 get shown in the datagrid... here's the problem... I load the dataSet with all possible entries at Form_Load event... but during the search I don't want to change the initial...
0
2210
by: Michael Fay in SB | last post by:
A month ago I posted: "I built my application with Access 2003 and made a distribution using the Microsoft Office Access 2003 Developer Extensions. (I also install Jet 8 as a follow-on action at the end of the installation.) I can install the application on my development PC and on a "bare" PC. Regardless of the PC where I install, in the...
0
3378
by: Curious | last post by:
Hi, I'm not sure if this is the right place to post such command issues. If you know a better forum where people respond to messages fairly often, please let me know! Anyway, would appreciate your help! --------------------------------------------------------------------------------------------------------------- Hi, I've created a...
10
4541
by: dstorms | last post by:
Hi, I'm trying to create a button on a form that: 1. Takes the ComputerID from the form linked to Table 1, 2. Checks Table 2 for a matching ComputerID, and 3. Opens the query qryEditData, and 4. If no match can be found, adds a new record in Table 2 and enters the ComputerID automatcially. The goal is to create a new record in Table 2...
1
7082
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that someone who bothers to read all of it have some pointers. Note, I have posted the stack trace and the code exhibiting the problem further down...
2
1979
by: Jolie Chen | last post by:
I am learning template programming now, and I wrote the following code #include <iostream> #include "Queue.h" using namespace std; template <typename Tclass QueueItem { public: QueueItem(T item):value(item),next(0){}
2
3952
by: =?Utf-8?B?U3dhcHB5?= | last post by:
hi, I am working on application in this i am using two files. In first (consider A) file i am calling the function of other file (consider B). In that function of file B i am calling the method of DLL. i.e Method of file A -Method of file B -Method of DLL. But in the file B's method while calling DLL's method it is giving me Error...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7751
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5323
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4943
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3440
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1874
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
700
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.