Title: RE: [expert] The gcc compiler for 'C' and open/read/fscanf/scanf

Hi Mike,
This test program works for me, for instance:

/* begin */
#include <stdio.h>

int main()
{
   int a=0;
   printf("Enter integer number: ");
   scanf("%d", &a);
   printf("a=%d\n", a);
   return 0;
}
/*end*/

I think it would help if you post a short exapmle of your scanf()
that makes a problem.

I can see 2 sources of possible problems with scanf():
1) the amount of format specifiers (i.e. %d, %f, %s etc ) in format string must be equal to the amount of parameters you pass after that string;

2) you should pass an *address*, i.e. if you want to read the data into integer 'a', you say '&a'.

  Tima.

-----Original Message-----
From: Michael Bidun [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 18, 1999 6:50 PM
To: [EMAIL PROTECTED]
Subject: [expert] The gcc compiler for 'C' and open/read/fscanf/scanf


I'm an old UNIX hack and have started some development under LINUX.

I've written a Makefile and a few "hello world" type progams.  When I try to
use the
fscanf or read commands after using fopen(...) or the open(...) commands, it
hangs my xterm and I can't even kill -9 out of it.  Needless to say the
read/fscanf don't work.  Alas, I also found that I could not even get scanf
to work.  I've checked all the parms, read the man pages etc.  Is there any
problems in this area that I should be aware of (wouldn't figure there would
be)?  If not, could you send me a small sample piece of code that you've
tested and know works?

This is my first time posting and don't know if this is the right place.

thanks,

mike bidun  [EMAIL PROTECTED]

Reply via email to