Total members 11895 |It is currently Sun Dec 22, 2024 10:36 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





In a pgm,if the input is a single line or several lines,what is the
statement i have to give.I have to get the input as a whole.




Author:
Proficient
User avatar Posts: 280
Have thanks: 1 time

I _suggest_ that you mean the following:

You have a program which works on standard input. No matter whether
this standard input consists of no input, one single line, or many
lines of input, you have to process this input as a whole.

Is my understanding correct?

If so, in C you might want to use fread() in a loop until feof() is true:
Code:
while (1)
{ if (fread( myBuffer, 1, sizeof( myBuffer), inputFile) !=
sizeof( myBuffer))
break; /* end of file reached or error occurred */
if (feof( inputFile))
break;
...
}


Within this loop, append the current buffer content to the whole input
that you've read so far.
Before doing so, you should check whether the piece of memory you have
allocated for the whole input is large enough to hold the current
contents of "myBuffer"; if not, you will have to reallocate this
memory or react in some other useful way (for example, terminate the
program after printing an error message).

_________________
Please recommend my post if you found it helpful


Author:
Proficient
User avatar Posts: 228
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : getting a full line input
 Reading a File Line by Line in php     -  
 full Screen Graphics     -  
 Full Encription System (DES-AES,RSA and more)     -  
 Full scrollable table     -  
 Full Screen graphics (Lesson 2).     -  
 Full Phone Book System php and mysql     -  
 How to show full resolution image at clicking on thumnail     -  
 Java Websphere Portal Developer Full-time position in IL     -  
 Only numeric input in JTextField     -  
 input suggestion using Javascript     -  



Topic Tags

C++ Files and I/O
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com