Discuss More on files. in the C Programming forum on Dev Shed. More on files. C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
Posts: 17
Time spent in forums: 3 h 31 m 51 sec
Reputation Power: 0
More on files.
I'm just testing to make sure I'm understanding this and I have a few questions.
#include<stdio.h>
int main()
{
int i,ii;
FILE *RandW;
char fname[] = "Success.txt";
RandW = fopen(fname,"w");
fprintf(RandW,"%d %d",56,23);
fclose(RandW);
RandW = fopen(fname,"r");
fscanf(RandW,"%d %d",&i,&ii);
fclose(RandW);
printf("%d %d is in Success.txt",i,ii);
getchar();
return 0;
}
That's my code. It works, but I have to to ask. when using fscanf, is the only way you can find text in the file is if you add a variable(i,ii) to the program.
also, I saw a word called append as one of the second arguments in fopen(). What does append mean? Reading reads input, writing shows output but what's append? Does it check to make sure?
Posts: 6,122
Time spent in forums: 2 Months 2 Weeks 3 Days 13 h 38 m
Reputation Power: 1949
If your compiler did not come with a help file, then Google on man page fopen for the documentation for fopen. You can also Google for the man pages of any other C Library function.