This is my code that I'm using:

void create_project_go()
   {
    FILE *fp;
    FILE *fopen("/usr/lib/htmlexamples/default.html", "r");

   };

and i get this error:

/home/miguel/Documents/packing/create_project.c||In function ‘create_project_go’:|
/home/miguel/Documents/packing/create_project.c|40|error: expected declaration specifiers or ‘...’ before string constant|
/home/miguel/Documents/packing/create_project.c|40|error: expected declaration specifiers or ‘...’ before string constant|
/home/miguel/Documents/packing/create_project.c|39|warning: unused variable ‘fp’|
/home/miguel/Documents/packing/create_project.c||In function ‘get_project_info’:|
/home/miguel/Documents/packing/create_project.c|46|warning: passing argument 1 of ‘gtk_entry_get_text’ from incompatible pointer type|
/home/miguel/Documents/packing/create_project.c|47|warning: format not a string literal and no format arguments|
/home/miguel/Documents/packing/create_project.c||In function ‘enter_project_info’:|
/home/miguel/Documents/packing/create_project.c|92|warning: passing argument 1 of ‘gtk_entry_get_text’ from incompatible pointer type|
/home/miguel/Documents/packing/create_project.c|100|warning: passing argument 1 of ‘gtk_box_pack_start’ from incompatible pointer type|
/home/miguel/Documents/packing/create_project.c|101|warning: passing argument 1 of ‘gtk_box_pack_start’ from incompatible pointer type|
/home/miguel/Documents/packing/create_project.c|102|warning: passing argument 1 of ‘gtk_box_pack_end’ from incompatible pointer type|
/home/miguel/Documents/packing/create_project.c|92|warning: unused variable ‘str’|
||=== Build finished: 2 errors, 8 warnings ===|

any help??? i've checked to make sure everything exists and stuff

thanks
~ mike

Recommended Answers

All 6 Replies

Based upon your post, may I suggest you start with something similar out of a book such as the "Hello World" program!

#include <file.h>

void create_project_go()
 {
    FILE *fp;    
      // Open an existing text file for reading!
   fp = fopen( "/usr//lib/htmlexamples//default.html", "rt"); 
  if (NULL != fp)
  {



        fclose(fp);
    }


   };
commented: 16 Posts, still no code tags -2

Your 3rd line is wrong. It must be fp=fopen("/usr/lib/htmlexamples/default.html", "r");
because fp is the pointer to the string not fopen, you somewhat muddled it. Or otherwise you can have it this way
FILE *fp=fopen("/usr/lib/htmlexamples/default.html", "r");

Your 3rd line is wrong. It must be fp=fopen("/usr/lib/htmlexamples/default.html", "r");
because fp is the pointer to the string not fopen, you somewhat muddled it. Or otherwise you can have it this way
FILE *fp=fopen("/usr/lib/htmlexamples/default.html", "r");

thanks, that fixed the problem, the only thing i don't get is that i copied that from cprogramming.com and it didn't work, someone really should let them know lol

anyways, THANKS!

It is the users who write the code and they sometimes may be wrong.

Such a thing would never happen in DANI because here on DANIWEB if there are 100s to tell you where you are right there are 1000s to tell you where you are wrong...!!!

Daniweb ROCKS !!!

thanks, that fixed the problem, the only thing i don't get is that i copied that from cprogramming.com and it didn't work, someone really should let them know lol

anyways, THANKS!

well, you copied the program and found the error. Maybe that someone sould be athlon32. :icon_wink:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.