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 8736043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:12:51+00:00 2026-06-13T10:12:51+00:00

Hey I have a snippet of assembly code that does not make sense to

  • 0

Hey I have a snippet of assembly code that does not make sense to me

.text:004016C5 prompt_uid:             ; "[ User %d    ]\t"
.text:004016C5 mov     [esp+0Ch+var_C], offset aUserD
.text:004016CC mov     ecx, [ebp+arg_0]
.text:004016CF mov     [esp+0Ch+var_8], ecx
.text:004016D3 call    printf
.text:004016D8 mov     [esp+0Ch+var_C], esi
.text:004016DB call    gets
.text:004016E0 test    eax, eax        ; test eax=0
.text:004016E2 jz      short prompt_uid

At first I was confused by the test eax,eax and jz following a gets.

“Why would any input be 0?”. Then I thought
“Ok. strings are terminated by a nullbyte so an empty string should result in the test setting ZF”

But when I tested it in practice the jz was never taken. Even when I just hit enter at the prompt.

Where is my mistake?

  • 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-06-13T10:12:52+00:00Added an answer on June 13, 2026 at 10:12 am

    The gets() reference gives the answer to when it will return NULL;

    RETURN VALUE

    Upon successful completion, gets() shall return s. If the stream is at
    end-of-file
    , the end-of-file indicator for the stream shall be set and
    gets() shall return a null pointer. If a read error occurs, the error
    indicator for the stream shall be set, gets() shall return a null
    pointer, [CX] and set errno to indicate the error.

    In other words, gets() may return NULL on end of file or a read error, not in normal “press return” operation.

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

Sidebar

Related Questions

Hey I have code that wires up the tabs in the Ready function for
Hey I Have some Problem to Find Exact Imotion(Facebook) for That Smily Code.. I
Hey guys I'm working on a jQuery code snippet that's suppose to remove a
Hey I have this code right here: http://pastie.org/534470 And on line 109 I get
Hey I have a really annoying IE7 bug that I am trying to work
Hey I have this code but it doesn't work because it is expecting a
Hey we have a library class (lib/Mixpanel) that calls delayed job as follows: class
Hey, long story short I have inherited some terrible code. As a result a
Hey I have a list that has values in it, I want to print
Hey I have following code like this public object RetrieveItemRun(int item) { if (dictionary.ContainsKey(item))

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.