07-11-2007
erroneous output
#include<stdio.h>
int main ()
{
FILE* f_read;
FILE* f_write;
char *string[80];
f_read=fopen("file1","r");
while(!feof(f_read));
{
fscanf(f_read,"%s",string);
fprintf(stdout,"%s\n",string);
}
return 0;
}
INPUT FILE
___________
manu
jilu
ruta
OUTPUT
-----------
manu
jilu
ruta
ruta
why the last line is being read two times
6 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi - I am new to the Unix environment and have encountered a problem I can't resolve. I inadvertently created a data file with a
period/dot at the end of the word 'dat', I.e. filename.dat. and can't remove it using the 'rm' command. In attempting to do so, I receive a message reading that the... (3 Replies)
Discussion started by: PLF
3 Replies
2. Shell Programming and Scripting
how to make a line BLINKING in output and also how to increase font size in output
suppose in run a.sh script
inside echo "hello world "
i want that this should blink in the output and also
the font size of hello world should be big ..
could you please help me out in this (3 Replies)
Discussion started by: mail2sant
3 Replies
3. Shell Programming and Scripting
Hi All,
I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file.
Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies
4. Shell Programming and Scripting
Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions.
... (4 Replies)
Discussion started by: aix_admin_007
4 Replies
5. Shell Programming and Scripting
Hi All,
I have result log file which looks like this (below): from the content need to consolidate the result and put it in tabular form
1). Intercomponents Checking
Passed: All Server are passed.
======================================================================
2). OS version Checking... (9 Replies)
Discussion started by: Optimus81
9 Replies
6. Shell Programming and Scripting
I have more than one files in a directory , namely
GLOW_OUT.txt
FIELD_OUT.txt
BASE_OUT.txt
...
SHOW_OUT.txt
What I wanted to do is to
I am working in Korn Shell
What I did was :
for file in <directory_name>/*.* ;do
cat $file | grep -v '^$' >> temp_file
rm $file
done
... (7 Replies)
Discussion started by: kumarjt
7 Replies
feof(3) Library Functions Manual feof(3)
NAME
feof - Tests EOF on a stream
LIBRARY
Standard C Library (libc)
SYNOPSIS
#include <stdio.h>
int feof(
FILE *stream);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
feof(): XSH5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Specifies the input stream.
DESCRIPTION
The feof() function tests the EOF (end-of-file) condition on the specified stream.
NOTES
[Tru64 UNIX] The feof() function may be a macro (depending on the compile-time definitions used in the source). Consequently, you cannot
use this interface where a function is necessary; for example, a subroutine pointer cannot point to it.
RETURN VALUES
If EOF has previously been detected reading the input stream specified by the stream parameter, a nonzero value is returned. Otherwise, a
value of 0 (zero) is returned.
RELATED INFORMATION
Functions: ferror(3), fileno(3), clearerr(3), fopen(3)
Standards: standards(5) delim off
feof(3)