c - How to read multiple number from a text file -


Then this is my code and I'm getting division error. How can I format this code to read a set of numbers from a file?

My input looks like this: 82, 46, 71, 56, 44, 12, 100 62, 67, 64, 65, 62, 39, 68, 68, 90, 78, 57, 76, 45 , 82 etc.

  #include & lt; Stdio.h & gt; Int main () {FILE * input = fopen ("input.txt", "r"); Integer line [7]; Int store = 0, read; If (! Input) {printf ("Error: file name \" input.txt \ "not found! \ N); } Store = 0; While (fscanf (input, "% d", read more)! = EOF) {line [store] = read; Shop ++; } Printf ("% d% d% d% d% d% d% d \ n", line [0], row [1], row [2], row [3], row [4], row [5] ]], Line [6]); Return (0); }   

Change your time lapse position to:

  while (store and lieutenant; size) / sizef (& amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; d & # 39;; & more!) = EOF)   

If there are more numbers in the input then there is space for you.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -