i have a function, GetCPUType(), that returns a local (but static)
string.  this works from main():

   char buf[BUFFERSZ];
   strcpy(buf, GetCPUType(proc_cpu));
   printf("CPU Type: %s", buf);

this doesn't (it prints garbage):

   printf("CPU Type: %s", GetCPUType(proc_cpu));

the function looks like:

   char *GetCPUType(const char *file)
   {
      static char *ptr;
      /* do stuff with ptr */
      return ptr;
   }

what's the difference between putting ptr into a buffer and printing the
buffer vs. printfing the pointer to a string directly?  ptr ends with
\0.

pete
_______________________________________________
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to