回精華區
作者itoc.bbs@cpu.tfcis.org (核心動力) 看板: plan
標題Re: [問題]有舉辦投票or賭盤同時在板上po文
時間動力核心 (2005/06/09 Thu 03:13:06) Updated: 2005/06/09
※ 引述《dreambird.bbs@bbs.wretch.cc (bird)》之銘言:
> 有舉辦投票or賭盤同時在板上po文

  先做精華區
  [功能] post.c 發文到看板

: vote.c:vote_add()

static int
vote_add(xo)
  XO *xo;
{
+ FILE *fp;

  ...
  ...

  rec_add(dir, &vch, sizeof(vch));

+ sprintf(fpath, "tmp/vote.%s", cuser.userid);
+ if (fp = fopen(fpath, "w"))
+ {
+   sprintf(title, "本板開始%s", vch.vgamble == '$' ? "賭盤" : "投票");
+
+   /* 文章檔頭 */
+   fprintf(fp, "%s %s (%s)\n", str_author1, cuser.userid, cuser.username);
+   fprintf(fp, "標題: %s\n時間: %s\n\n", title, Now());
+
+   /* 文章內容 */
+   fprintf(fp, "%s\n%s\n", title, vch.title);
+   fclose(fp);
+
+   add_post(currboard, fpath, title);
+   unlink(fpath);
+ }

  vmsg("開始投票了!");
  return vote_init(xo);

--
  Origin:  Maple-itoc˙動力核心  cpu.tfcis.org 
  Author: itoc itoc.Dorm11.NCTU.edu.tw 發表
精華選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻