-1
I wonder how I do to open a file in C (Open even, as if I had double-click), because the way I did, the program says that the file was opened, but it is not actually opened.
If the C language can’t do that, what language can I use?
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
FILE *arquivo = fopen("c:\\eu.txt", "r");// testa se o arquivo foi aberto com sucesso
if(arquivo != NULL)
printf("Arquivo foi aberto com sucesso.");
else
printf("Nao foi possivel abrir o arquivo.");
printf("\n\n");
system("PAUSE");
return 0;
}
What do you mean, double-click? You want to upload the file contents or you want to display the file contents with the file manager of that particular file type?
– Felipe Avelar
If the message "File opened successfully" appears then it is open. If in addition you want to display the contents of this file then you will have to include in your program the appropriate commands for this and, at the end, do not forget to close the open file.
– anonimo