cannot convert 'int' to 'void * '

This is a discussion on cannot convert 'int' to 'void * ' within the C++ Programming forums, part of the General Programming Boards category; when i try to compile the below code i get the following error cannot convert 'int' to 'void * ' ...

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    2

    cannot convert 'int' to 'void * '

    when i try to compile the below code i get the following error
    cannot convert 'int' to 'void * '

    gets(name);cin>>age>>number;
    gets(batstyle);
    cin>>runs>>inn>catches>>hs>>half_cent>>cent;

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,651
    First, don't use gets! EVER!

    Second, there's not enough code here to say. Copy your entire code and the exact errors you are receiving.

    Although, if this isn't a typo, this is a problem:

    Code:
    inn>catches

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,663
    Don't use gets/fgets in a C++ environment. A good substitute is std::string and std::getline:

    std::string name;
    std::getline(std::cin, name);
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Jul 2011
    Posts
    2
    thanks....i didnt notice that i put only 1 '>'..thanks dude

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [33.8] Can I convert a pointer-to-function to a void*?
    By EVOEx in forum C++ Programming
    Replies: 40
    Last Post: 08-19-2009, 07:50 AM
  2. cannot convert from 'void *' to 'node *'
    By NyHoK in forum C Programming
    Replies: 1
    Last Post: 04-01-2009, 08:54 AM
  3. 'initializing' : cannot convert from 'void *' to 'int *'
    By C++beginer in forum Windows Programming
    Replies: 6
    Last Post: 09-11-2005, 09:29 PM
  4. '=' : cannot convert from 'void *' to 'struct HBRUSH__ *'
    By Bajanine in forum Windows Programming
    Replies: 9
    Last Post: 10-14-2002, 07:54 PM
  5. Error: explicit type cast cannot convert 'void* to 'int*'
    By juschillin in forum C++ Programming
    Replies: 5
    Last Post: 09-04-2002, 09:19 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21