Click here to Skip to main content
15,887,910 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to export a file created and filled by the current program at the end.Its a log file that program writes what it does. I open a file with fopen and writing what I am doing in the program. when I type on terminal "gedit file.c" It shows me the file but program should type it for me not myself.

The main problem is that I am creating a logFile in desktop and at the end I want program to show me that file automaticly.I dont want to get the path and click on the file to open it.I want program to export it automaticly. which method should I use?
Posted
Updated 22-Apr-13 4:26am
v5
Comments
Matthew Faithfull 22-Apr-13 8:06am    
So you want to export a log file. Which country are you wanting to export it to? Do you need a permit?

I think your question requires some clarification before you can get a useful answer.
[no name] 22-Apr-13 8:20am    
I am building a file in desktop and fill it in program.At the end of program I want to export it..I do not want to get desktop and click on the file to open it.I want program to open it automaticly..
Matthew Faithfull 22-Apr-13 8:43am    
So you want to open the file for editing automatically. That makes sense and execl should be able to do that for you. There is nothing here that resembles exporting, export or anything that was once a port so my advice is to remove all confusing references to export from your question. I will work on a solution.
[no name] 22-Apr-13 10:10am    
I think execl doesnt do what I desire. updated question. Hope I will get a result.Thanks
Richard MacCutchan 22-Apr-13 8:14am    
Your code spawns the gedit program, but does nothing else.

Thanks to you all. I have found the solution.
C#
int main(int argc,  char *argv[]) 
{
   system("gedit hello.c");

   return 0;
}
 
Share this answer
 
This one works too.
execlp("/usr/bin/gedit","gedit","hello.c",NULL);
 
Share this answer
 
Comments
RedDk 22-Apr-13 14:07pm    
Which one of these Solutions (01 or 02) have you accepted?
[no name] 24-Apr-13 3:09am    
Both are true.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900