Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Trouble with pointers

Trouble with pointers

Trouble with pointers

I'm begginers in language C a need your help.

This is in my main.c and that printf realy write way to file, but...

After that when i push some key program doesn't work and I dont know why ...

All problem is, I get file.c and I search in #include command and way to external(including) file. And I want to ways in *p_ways[]. It's possible?


char *p_ways[number_stars];
int number_include = load_way(result, number_stars, (&p_ways) );
printf("Way: %s\n",p_ways[0]);
printf("Way: %s\n",p_ways[1]);

This is function load_way


int load_way(char *source, int hasmark, char **way){
char *p_temp;
char *p_tmp;
char include[] = "#include";
int cnt = 0;
int TRUE = 1;
p_temp = strtok(source, " \r\n\t");

int delka;
while(p_temp != NULL){
     if(strcmp(p_temp,include) == 0){
      p_temp = strtok(NULL, " \r\n\t");
      if(p_temp == NULL){
        if(p_temp[0] == '\"'){
         delka = strlen(p_temp);
         delka = delka - 3;
         p_tmp = (char *)malloc( sizeof(p_temp) );
         int f;
         for(f = 0; f <= delka; f++){
               p_tmp[f] = p_temp[f+1];
         p_tmp[f] = '\000';
         way[cnt] = p_tmp;
     p_temp = strtok(NULL, " \r\n\t");
   return cnt;

Thx, for all comment!

RE: Trouble with pointers

Ohhhh, I'm sorry this question was to language C.... I'm so sorry!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close