Problem with unlink

This is a discussion on Problem with unlink within the Linux Programming forums, part of the Platform Specific Boards category; Code: xorl %eax, %eax pushl %eax pushl $0x61 movb $0xa, %al int $0x80 This is supposed to do unlink a ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    3

    Problem with unlink

    Code:
    xorl %eax, %eax
    pushl %eax
    pushl $0x61
    movb $0xa, %al
    int $0x80
    This is supposed to do unlink a file called "a" for demonstration purposes. I'm a total stranger with Linux assembly. Something tells me this should work though. Perhaps "pushl $0x61" is not what I'm looking for?

  2. #2
    Sr. Software Engineer filker0's Avatar
    Join Date
    Sep 2005
    Location
    West Virginia
    Posts
    235
    Looking at the code, it looks like you're pushing the character code for 'a' onto the stack. What the system call requires is a pointer to a nul terminated character sequence (a char *, if you will) with the name (path, whatever) to be unlinked, not the characters themselves, on the stack.
    Insert obnoxious but pithy remark here

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    3
    It appears so. I tried it with gdb to confirm that that was true. I shall try to work around this problem in an alternative way and return if further problems arise.

    Thanks :-)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 05:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21