473,320 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to fix an error GETLINE should have a prototype error

Can anybody tell me how to fix an error "GETLINE should have a prototype when i run following code under TC environment

Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include<fstream.h>
  4. #include<stdlib.h>
  5. #include<string.h>
  6.  
  7. void main()
  8. {
  9.     ifstream infile;
  10.     clrscr();
  11.     infile.open("sonu.txt");
  12.     if(infile)
  13.     {
  14.         char s[100]="";
  15.         while(getline(infile,s))
  16.         {
  17.          cout<<s<<endl;
  18.         }
  19.     }
  20.  
  21.     getch();
  22. }
Mar 16 '12 #1
3 9706
weaknessforcats
9,208 Expert Mod 8TB
Use a C++ string object rather than a char array.

Expand|Select|Wrap|Line Numbers
  1. string s;
  2. while(getline(infile,s))
  3. etc...
Mar 16 '12 #2
I did the same but y its giving error -prototype required
Mar 20 '12 #3
weaknessforcats
9,208 Expert Mod 8TB
You need to #include the header file for C++ strngs. Using string.h only works for C strings, not C++.

I don't know what the name of the correct include file is because you are using a very very old compiler. I can tell this because you include <iostream.h>. That file was obsolete in 1998.

The current file is <iostream> and the one for the C++ strings is <string>
Apr 1 '12 #4

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

Similar topics

13
by: Mark Johnson | last post by:
I had asked what might be examples of good design using CSS. One was suggested, which I didn't care for. But are there any others? Can anyone, rather than negatively complain, actually and...
0
by: Paul | last post by:
I've got an MSI that installs 2 Assemblies into the GAC, and I need to remotely run this. Now I can run it and advertise it, but that is not what I want. If I run the MSI (as administrator) I can...
2
by: Srinivas | last post by:
Hi, I have a folder called 'secure' containing many pages and these can be accessed after going through forms authentication. But I want one of the files appPage.aspx to be visible to everyone....
0
by: Michael Fitzpatrick | last post by:
I have a .NET application with an installer. The customer wants the install page with the "Everyone" or "Just Me" selection to default to "Everyone". Presently it defaults to "Just Me". Any hints...
4
by: Ronald S. Cook | last post by:
I created an MSI install for a Windows app I wrote. When installing, however, it defaults to install for "Just Me" instead of "Eveveryone" (meaning anyone who uses this computer). I would like...
1
by: ImageAnalyst | last post by:
Yay!!! They fixed this for VS2005. You can now set the default installation to be "Everyone" instead of "Just Me" and you can control whether you even want those radio button installed in your...
0
by: Samuel R. Neff | last post by:
I'm having trouble creating a Semaphore with read-access rights for everyone. Originally I was trying to use this code: semaphore = new Semaphore(maxLocks, maxLocks, "RwLock#" + name); but...
9
by: PomonaGrange | last post by:
HI All, I've been trying to make a membership management type script. This script would have a database with the members contact info and which office they hold, if any. The problem I am having is I...
6
by: kinedesigner | last post by:
We're using a perl script to fetch images from the inhouse server & pump them to a remote server with much higher bandwidth. I want to remove the Everyone account from the target folder on the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.