LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 01-28-2005, 04:45 PM   #1
hubabuba
Member
 
Registered: Jan 2002
Location: UK
Distribution: Slack 12.1, 2.6.24.5
Posts: 185

Rep: Reputation: 30
makes pointer from integer without a cast ?


what does the following message mean?

warning: ..... 'strncpy' makes pointer from integer without a cast

I try to fix the code myself so i will learn better, but i just don't understand some messages that the compiler spits out.

Thanks
 
Old 01-28-2005, 05:15 PM   #2
Frankablu
LQ Newbie
 
Registered: Jan 2003
Posts: 12

Rep: Reputation: 0
It means you have directly assigned the value of a integer to a pointer,
you probaility as in 99.999% of the time you want to assign the address of the integer to the pointer,

e.g.

ptrMyPointer = &MyInteger

& gives the address of the variable,

instead of ptrMyPointer = MyInteger which should give back nonsense more or less.
 
Old 01-28-2005, 05:28 PM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,524

Rep: Reputation: 93
Quote:
warning: ..... 'strncpy' makes pointer from integer without a cast
strncpy() takes two strings and an int as its parameters, you can see that in its man page:

"char *strncpy(char *dest, const char *src, size_t n);"

Maybe you have an int as the first or second parameter?

Are you trying to copy/convert a number into a string. If so, check out sprintf() instead if strncpy().
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparison between pointer and integer ---> WHY?? its_godzilla Programming 10 01-28-2005 09:40 PM
pointer from integer without a cast bcf2 Programming 7 12-30-2004 02:04 PM
makes pointer from interger without a cast y0shi Linux - General 4 10-21-2004 08:17 PM
Passing arg 3 of blah makes pointer from integer without a cast xconspirisist Programming 6 08-22-2004 08:04 AM
pointer to bog standard integer acid_kewpie Programming 4 02-02-2002 03:14 PM


All times are GMT -5. The time now is 08:56 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration