0

I know there's a posts about this and I have tried to go through them and they haven't seemed to solve my issue. I'm guessing it's something simple that I've overlooked, but I swear I don't see it.

So here goes...

from main

char *newstr = argv[3];
header(newstr);

function header

void header(char *read_file){

I'm getting conflicting types for 'header', and warning: passing argument 1 of 'header' from incompatible pointer type.

I went through the reference links from this thread and it seems like I'm following the right path to passing the arguments. My only guess is that it has something to do with argv.

Here's my args too, I've been using them just fine before this tripped me up.

-q Imhere.txt b.txt dynArray.c b.txt
Community
  • 1
  • 1
hobbes131
  • 313
  • 6
  • 14

2 Answers2

2

This compiles fine for me (using gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)) :

#include <stdio.h>

void header (char *read_file) {
    printf("%s\n", read_file);
}

int main(int argc, char* argv[]) {
    char *newstr = argv[3];
    header(newstr);
    return 0;
}

with output:

$ ./a.out -q Imhere.txt b.txt dynArray.c b.txt
b.txt
Peter K.
  • 8,028
  • 4
  • 48
  • 73
0

after your compilation options, do this [gcc ........ 2> ERROR.TXT]

then post these errors here so we can see what's wrong.

Dmytro
  • 5,068
  • 4
  • 39
  • 50