This is my main.cpp
:
int main () {
FILE* file_name;
file_name= fopen("email1.clear","wb");
return 0;
}
I run it with the ssh (Linux):
g++ main.cpp -o main
but no file has been created. (I must to use: FILE*).
please help.
This is my main.cpp
:
int main () {
FILE* file_name;
file_name= fopen("email1.clear","wb");
return 0;
}
I run it with the ssh (Linux):
g++ main.cpp -o main
but no file has been created. (I must to use: FILE*).
please help.
> How Do I Compile/Run My Program?
To compile C/CPP program first.cpp, and create an executable file called first, enter:
$ gcc first.cpp -o first
OR
$ cc first.cpp -o first
To execute program first, enter:
$ ./first
Well I recomend that you use "a+"
instead of wb
first of all because "a+"
let's you create a file if it doesn't exist and if it does it let's you add stuff in the file. Second well I don't know if you are going to use binary because the b
in wb
is for binary don't put it if you don't need it. So your code should look something like this:
int main () {
FILE* file_name;
file_name= fopen("email1.clear","a+");//or just use "w" bot work
return 0;
}
also the file might been placed where the .cpp is save they are usually saved together.