Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

YukiRaven

Members
  • Content count

    4189
  • Joined

  • Last visited

About YukiRaven

  • Rank
    Will DDR for food

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Single Status Update

See all updates by YukiRaven

  1. In C/C++ class we have an assignment due (actually due two weeks ago, but I have an extension) where we have to make a very simple client/server program. The client sends data to a server, which writes a very simple database of whatever we want. So I'm making a simple videogame database.

    The thing is, we have to use system calls for the files, so open(), close(), read(), and write(). I've got everything working, reading, and writing fine except one thing. The database I made is ├╝ber simple: first four bytes are an integer saying how many records are in it, the rest are records (structs). When I write a new one, the program's suppose to just overwrite the first four bytes, goto the end, and write there. For some reason, even though write() returns that it wrote four bytes, it still never gets past 1. Code:

    code snippit

    code:
    Array
    Am I doing something wrong?

    1. YukiRaven

      YukiRaven

      Actually, I found out it was because I was opening it with the flag O_APPEND or'ed in.

    2. AndrewB

      AndrewB

      Ohhh.. Of course!

×