Thread: Problem with unlink

  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, 04: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, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM