Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7509831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:02:36+00:00 2026-05-29T23:02:36+00:00

pthread_t writeToFile = pthread_self (); unsigned short iterate; for (iterate = 0; iterate <

  • 0
    pthread_t      writeToFile = pthread_self ();
    unsigned short iterate;

    for (iterate = 0; iterate < 10000; iterate++)
    {
        fprintf (fp, " %d ",  iterate,     4);
        fprintf (fp, " %lu ", writeToFile, sizeof (pthread_t));
        fprintf (fp, "\n",    writeToFile, 1);
    }

In main () fp = fopen ("xyz", "w");

Warning: warning: too many arguments for format

From here: http://www.cplusplus.com/reference/clibrary/cstdio/fprintf/

What’s wrong in my code?

gcc version 4.5.0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:02:37+00:00Added an answer on May 29, 2026 at 11:02 pm

    Let’s take your first fprintf: " %d ". it expects one argument (an int), but you give it two – iterate and 4.

    It seems like you are adding the size of the data, but you shouldn’t. It should probably be:

    fprintf (fp, " %d ",  iterate);
    

    In the other two sentences, it’s not even clear what do you want to put in the file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include<pthread.h> #include<stdio.h> #include<semaphore.h> void func(); int a; int main() { pthread_t thread1; sem_t semaphore1;
EDIT 1: FILE *fp; pthread_mutex_t demoMutex; unsigned short globalThreadIndex = 0; struct serverInfo {
typedef struct { pthread_t threadId; int acceptSocketD; char *message; } threadData; map <unsigned int,
I presumed that a pthread_t remains constant - for a given thread - for
Let's say I: malloc a pthread_t for holding a thread context pthread_create with as
The function header for pthread_create looks like this: int pthread_create(pthread_t * thread, const pthread_attr_t
pthread_cleanup_pop_restore - what is it? It is from glibc. And it is called too
Fault address occurred when i malloc pthread_t to save a newly created thread id
I have set up the following struct: typedef struct _thread_node_t { pthread_t thread; struct
Using C++. pthread_t threads[STORAGE]; // 0-99 ... void run() Error>>> int status = pthread_create(&threads[0],

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.