LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-27-2004, 06:43 AM   #1
shams
Member
 
Registered: Jan 2004
Posts: 535

Rep: Reputation: 30
error coding Input/Output in functions in C


hi,
this is a code for the Input/Output in c:
include <stdio.h>
main()
{
FILE *fs;
char ch;
int nol = 0; not = 0, nos = 0, noc = 0, nob = 0;

fs=fopen("PR1.C","r");

while(1)
{
ch=fgetc(fs);

if(ch==EOF)
break;

noc++;

if(ch=='')
nob++;

if(ch=='\n')
nol++;

if(ch=='\t')
not++;

}
fclose(fs);


printf(" Number of characters=%d\n",noc);
printf(" Number of blanks=%d\n",nob);
printf(" Number of tabs=%d\n",not);
printf(" Number of lines=%d\n",nol);

}
and this is the compilation error:
[root@localhost i-o]# gcc -o l330 l330.c
l330.c: In function `main':
l330.c:6: error: `not' undeclared (first use in this function)
l330.c:6: error: (Each undeclared identifier is reported only once
l330.c:6: error: for each function it appears in.)
l330.c:6: error: `nos' undeclared (first use in this function)
l330.c:6: error: `noc' undeclared (first use in this function)
l330.c:6: error: `nob' undeclared (first use in this function)
l330.c:19:13: empty character constant
plz point me the mistake.
 
Old 08-27-2004, 06:46 AM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
by shams
int nol = 0; not = 0, nos = 0, noc = 0, nob = 0;

looks like a typing error to me, try replacing the semicolon with a comma
 
Old 08-27-2004, 06:49 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
Quote:
int nol = 0; not = 0, nos = 0, noc = 0, nob = 0;
Been there done that
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Input/output error rob19 Linux - Newbie 14 08-21-2012 09:35 PM
aplay: pcm_write:1029: write error: Input/output error mimithebrain Linux - Software 2 12-04-2007 11:51 AM
cp - error reading /mnt/cdrom/mpegav/avseq01.dat input/output error manishsingh4u Linux - General 2 10-17-2005 05:02 AM
dd: input/output error? logosys Linux - Newbie 3 09-19-2005 02:13 AM
Input/Output error arctuniol Linux - Software 2 10-06-2003 05:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration