Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22213

Invaild initializer for scanf [closed]

$
0
0

GCC won't compile my code because of scanf is a "Invalid initializer," and i don't see why it wont compile.

Heres the code:

#include <stdio.h>#ifdef WIN32#include <io.h>#define F_OK 0#define access _access#endifint main() {  // vars  FILE *fptr;  char opt = scanf("");  char contents[99999999999] = "";  printf("Logging system | always add date!");  printf("SELECT:\n_______________________\na     Write to the log\nr     Read the log");  if (access(fptr, F_OK) == 0) {    fptr = fopen("log_sys.log", "w");} else {      if (opt == "a") {        fptr = fopen("log_sys.log", "a");        char a[190] = scanf("LOG(max 190 char):   ");        fprintf(fptr, a[190]);        fclose(fptr);  } else if (opt == "r") {    fptr = fopen("filename.txt", "r");    fgets(contents, 1215752191, fptr);    printf("%s", contents);  }}  system("pause");  return 0;} 

This is a string logger, for general purpose for people to write to files as like a post it note.


Viewing all articles
Browse latest Browse all 22213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>