I've finished with what needs to be done which open a text file format it a certain way such as removing white spaces at the beginning of lines etc. This is just something alittle extra I'm trying to do. Which is prompt the user to enter in the path/filename of a text file. Then the program will open it and do the rest, but when ever I type in the path/filename nothing happens, I'm pretty sure I screwed the syntax somewhere but I can't figure out where.
Code:int main( void ) { int exit_status = EXIT_SUCCESS; FILE *fp; printf("\n\nType in the path and file name\n\n\n", fp); scanf(&fp ); fp = fopen ; // Where I'm running into problems if( fp == NULL ){ printf("\nPlease enter a valid file\n"); exit_status = EXIT_FAILURE; int count = 0; int c, copy; while((c = fgetc(fp)) != EOF){ if(c == ' '&& copy == ' ') continue; else putchar(c); copy = c; if( c == ' ' && c == '}' && copy == ' ' && copy == '}') count -= 1 ; if( c == ' ' && c == '}' && copy == ' ' && copy == '}') count += 1 ; } return 0; } }



LinkBack URL
About LinkBacks


