Sponsored Content
Top Forums Programming Need hep with my semantic error Post 302742133 by fwrlfo on Monday 10th of December 2012 03:23:03 PM
Old 12-10-2012
Need hep with my semantic error

Code:
while(EOF != (c = fgetc(filePtr))) 
 {

    if ((c == ' ') || (c == '\n') || (c == '\0'))
    {
        if (c == '\0')
        {
            continue;
        }
	
	printf("%s",cc);
	printf("%c\n");
	memset(cc, 0, sizeof cc);

    }
	else
	{ 
	cc[i]=c;
	i++;
	}

I supposed from that code to print word by word from text file but there is something wrong with <<<<memset(cc, 0, sizeof cc);>>>>>
it give me like that
Image
 

3 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

syntax and semantic check

Does the shell perform a syntax and semantic check before commands are sent to the kernel? Ravioli (3 Replies)
Discussion started by: ravioli
3 Replies

2. UNIX for Dummies Questions & Answers

Hep with script to monitor directory

Hello, I am a newbie who is attempting to write a script to monitor a directory for a set of 3 files that I am expecting to get ftp'd. Occasionally, we suspend operations for maintenance etc. but we still get the files so there can be more than 1 set. If there is more than 1 set, I would like... (2 Replies)
Discussion started by: cmf00186
2 Replies

3. Programming

Tool for checking syntactic and semantic mistakes

Hello, it is easy to make mistake in c code. What ide or tool are you using for checking syntactic and semantic mistakes? Jarda (1 Reply)
Discussion started by: berk
1 Replies
getc(3s)																  getc(3s)

Name
       getc, getchar, fgetc, getw - get character or word from stream

Syntax
       #include <stdio.h>

       int getc(stream)
       FILE *stream;

       int getchar()

       int fgetc(stream)
       FILE *stream;

       int getw(stream)
       FILE *stream;

Description
       The function returns the next character from the named input stream.

       The function is identical to (stdin).

       The function behaves like but is a genuine function, not a macro.  It may be used to save object text.

       The  function returns the next word (in a 32-bit integer on a VAX-11 or MIPS machine) from the named input stream.  It returns the constant
       EOF upon end of file or error, but since that is a good integer value, feof and should be used to check the success of The assumes no  spe-
       cial alignment in the file.

Restrictions
       Because it is implemented as a macro, treats a stream argument with side effects incorrectly.  In particular, `getc(*f++);' doesn't work as
       expected.

Diagnostics
       These functions return the integer constant EOF at end of file or upon read error.

       A stop with message, `Reading bad file', means an attempt has been made to read from a stream that has not been opened for reading by

See Also
       fopen(3s), fread(3s), gets(3s), putc(3s), scanf(3s), ungetc(3s)

																	  getc(3s)
All times are GMT -4. The time now is 11:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy