Re: problems using fgets() and sscanf() while modifying file contents



allpervasive@xxxxxxxxx writes:
[...]
sorry for confusing you, i did a small mistake. now, here i attach the
exact code which i used.
hope now you can follow the code. input data and the desired output is
also shown below.
thanks

code:

void main()

main returns int, not void. The correct declaration is
int main(void)

See questions 11.12a, 11.12b, 11.14a, 11.14b, and 11.15 in the
comp.lang.c FAQ, <http://www.c-faq.com/>.

{
FILE *in1,*file2;

You haven't shown us your actual code. Without a '#include <stdio.h>',
the compiler doesn't know what a 'FILE' is; it would have rejected
your program with an error message, something like "Undeclared identifier".

You need to post your *exact* code, just as you fed it to the
compiler.

char file1[1000], file3[1000];
int num;
float value;
char in_region;

printf("\n\n Input File 1: "); /* Ask for File names */
gets(file1);

Never use gets(). See question 12.23 in the FAQ.

[snip]

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.



Relevant Pages

  • Re: reverse string, how to print string and not decimals?
    ... int length = strlen; ... Due to what is probably the wrong definition of acc, ... either up the warning level or upgrade to a competent compiler. ... Show us the exact code. ...
    (comp.lang.c)
  • Re: A doubt
    ... generated by compiler. ... int main ... C++ Faq: http://www.parashift.com/c++-faq-lite ... http://www.josuttis.com -- C++ STL Library book ...
    (comp.lang.c)
  • Re: Class default initialiation
    ... > You should post the exact code you ran (by pasting it from your source ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Compiling MIPSpro C program using MIPSpro C++ compiler on SGI system
    ... > void test (int t); ... I believe this is a severe case of language mixup. ... "CC" is the C++ compiler. ... Research "name mangling" in the FAQ ...
    (comp.lang.cpp)
  • Re: @@@ A Serious Question @@@
    ... >> int main{ ... One could simplify even futher. ... is this what the compiler finally generated??? ... C++ Faq: http://www.parashift.com/c++-faq-lite ...
    (comp.lang.c)

Loading