Both the declaration and definition for your stream function is incorrect. You can use NULL
the call, but the type of the parameter required for the declaration / definition void *
.
, - :
void *showart(void *);
void *showart(void *unused) { ... }
, :
#include<stdio.h>
#include<array>
#include<pthread.h>
#include<fstream>
#include<string>
void *showart (void *);
int main (int argc, char **argv) {
pthread_t thread1;
pthread_create (&thread1, NULL, showart, NULL);
getchar();
return 0;
}
void *showart (void *unused) {
std::string text;
std::ifstream ifs("ascii");
while(!ifs.eof()) {
std::getline (ifs, text);
printf ("%s\n", text.c_str());
}
}
, , , , , pthread_create()
, main()
, ..