writing part of a program where user inputs an ID and the program generates a .txt file with the ID name(numerical ID).

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define INFILE "config.txt"
#define OUTFILE "studentans.ans"
#define IDFILE "stdin"



int main(int argc, char *argv[]) {

FILE *fout;
fout = fopen(IDFILE, "w");
printf("Enter Student ID number:");
while(1) {
getc(stdin);    // id is entered

fputs(stdin, fout);    //generates the text file
}
return 0;
}

but i keep getting these errors:
14:14 C:\Dev-Cpp\assignment 4.c [Warning] multi-character character constant
14 C:\Dev-Cpp\assignment 4.c [Warning] passing arg 1 of `fopen' makes pointer from integer without a cast
20 C:\Dev-Cpp\assignment 4.c [Warning] passing arg 1 of `fputs' makes pointer from integer without a cast


using dev-cpp but programming in C
any ideas?

Your input and output methods are weird - consider something like this:

char line[255];
while(1) {
   fgets(line, 255, stdin);
   // NOTE: ideally you should validate input before printing to file

   fputs(line, fout);
}

Anyway, you can't just use stdin in place of a char *, which is what fputs expects. So of course you'll first need to retrieve the input before printing it to a file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.