Thread: nonportable pointer conversion

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    99

    nonportable pointer conversion

    I have an error :
    C:\WINDOWS\Desktop\Nate\c>bcc32 word.c
    Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
    word.c:
    Warning W8069 word.c 47: Nonportable pointer conversion in function main
    Warning W8069 word.c 47: Nonportable pointer conversion in function main
    Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland

    here is a snip of the code. Post if you need a bigger selection
    Code:
    /*---------cut here-----------*/
    if ((fd=fopen(argv[0], "r")) == NULL)
    {
         printf("File execution failure\n");
         return 1;
    }
    
    strcpy(word,argv[2]);
    while ( (fread(buf, sizeof(char),MAX ,fd )) != EOF) //line of error
    {
    	while ((result = search(buf, word, strlen(word)-1))!=1)
    		printf("%d)     %s",x++,*result);
    }
    /*----------cut here-----------*/

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    What are buf, MAX and fd defined as?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    99
    char *buf
    FILE *fd
    #define MAX 80

    Sorry I didn't define those in the post

  4. #4
    Registered User
    Join Date
    Oct 2002
    Posts
    98
    Salem,

    I was looking at the man page for fopen on Solarisv7, and I noticed this, said in relation to the options "r" or "rb"...

    " The character b has no effect, but is allowed for ISO C
    standard conformance (see standards(5))..."

    Is this something specific to the Solaris compiler?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quick Pointer Question
    By gwarf420 in forum C Programming
    Replies: 15
    Last Post: 06-01-2008, 03:47 PM
  2. Pointer array's and ASCII to bit conversion
    By AdamLAN in forum C++ Programming
    Replies: 12
    Last Post: 05-06-2005, 05:55 PM
  3. Header File Question(s)
    By AQWst in forum C++ Programming
    Replies: 10
    Last Post: 12-23-2004, 11:31 PM
  4. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  5. Replies: 2
    Last Post: 02-07-2002, 09:39 AM