Haha ok thank you. I think I'm starting to picture it a little better. So for reading everything in the file and sorting it in the array would I do this:
while (fscanf(fp," %c %c %d",...
Type: Posts; User: Robbie
Haha ok thank you. I think I'm starting to picture it a little better. So for reading everything in the file and sorting it in the array would I do this:
while (fscanf(fp," %c %c %d",...
Ok so maybe I've gone at this completely wrong. What would be the best way to read in that file and store the color at the specified index? Like 'b' at array[A][1]?
I was thinking about doing that actually. If I did that would it be legal to change column from a character array to a integer array and still read in the letters to that array?
Ok so I have a project where I read in a file containing a 3 columns of different numbers/letters. The three columns are [stone color] [column] [row]. For example
b A 1
b B 4
B b 1
B C 2...
;) ;)
The part that my ADD forced me to ignore.
works fine for me without the space.
Thanks everybody for all your help! I really appreciate it!
Nothing I read mentioned anything about this. Thanks for the help though!
Thank you so much!!
while (fscanf(fp," %c %c%d", &stone_color[i], &column[i],&row[i]) == 3)
and just for clarification and future use...why ==3? Where does the 3 come from?
boardtest.c:20: warning: incompatible implicit declaration of built-in function 'exit'
thats what happens when I compile it now.
Listen dawg....I popped a Vyvanse at around 4:00 P.M. yesterday thinking "Hell yeah gonna program the ........ out dis project." Sat down at my computer...read through the project, opened up putty...
Actually I did go back and read a little section on scanf the first time. Nothing. After your last post I said to myself "Hey maybe this guy is on to something. Maybe I should check the book again."...
Can you tell me why I'd use scanf instead of fscanf and why the condition is >2?
Ok switched the %s's to %c but I'm still getting segmentation fault. How would I write it so that it reads 3 columns at a time?
I have to write a program for my class and I am having a bit of trouble with the file pointer.
#include <stdio.h>
#include <string.h>
int main(void) {
char stone_color[82];
char...