Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C execl is this a bug ?

C execl is this a bug ?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 10929916
    wrote on last edited by
    #1

    inside a C function I have this code

    printf("%s",final);
    //execl(final,final,NULL);

    I do a fork and this is part of the childs code the final string is not printed when the execl line is not commented out,nor are any printf calls before it why is this happening ?

    L K L 3 Replies Last reply
    0
    • U User 10929916

      inside a C function I have this code

      printf("%s",final);
      //execl(final,final,NULL);

      I do a fork and this is part of the childs code the final string is not printed when the execl line is not commented out,nor are any printf calls before it why is this happening ?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Without seeing more code it is anyone's guess.

      1 Reply Last reply
      0
      • U User 10929916

        inside a C function I have this code

        printf("%s",final);
        //execl(final,final,NULL);

        I do a fork and this is part of the childs code the final string is not printed when the execl line is not commented out,nor are any printf calls before it why is this happening ?

        K Offline
        K Offline
        k5054
        wrote on last edited by
        #3

        Probably due to line buffering. Try

        printf("%s\n", final);

        or add

        fflush(stdout);

        before the execl() call;

        1 Reply Last reply
        0
        • U User 10929916

          inside a C function I have this code

          printf("%s",final);
          //execl(final,final,NULL);

          I do a fork and this is part of the childs code the final string is not printed when the execl line is not commented out,nor are any printf calls before it why is this happening ?

          L Offline
          L Offline
          leon de boer
          wrote on last edited by
          #4

          If your on Eclipse it is a known bug (id=173732) The fflush(stdout); fix is the only way around it as horrible as it is.

          In vino veritas

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups