24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 262  |  回复: 2
当前主题已经存档。

guoyaqun00

[交流] 【求助】关于C的编写问题

我想得到一些函数运行后的点,把它作为一个文本文件,导入绘图工具,请问用c怎么把点写入一个文件中?
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

LC3030

★ ★
woshilsh(金币+2,VIP+0):thanks for your help 5-13 16:55
FILE *p = fopen("1.txt","w";
fwrite("12,12",1,strlen("12,12",p);
2楼2009-05-13 16:50:26
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

冬青1129

银虫 (正式写手)

/*将此信息复制放入include文件夹中命名save pic.c,
写完程序绘图完成之后,调用(save_pic(C:\my.bmp))
#include
void save_pic(char *fn){
typedef long LONG;
typedef unsigned char BYTE;
typedef unsigned long DWORD;
typedef unsigned short WORD;
typedef struct tagBITMAPFILEHEADER {
        WORD    bfType;
        DWORD   bfSize;
        WORD    bfReserved1;
        WORD    bfReserved2;
        DWORD   bfOffBits;
} BITMAPFILEHEADER;
typedef struct tagBITMAPINFOHEADER{
        DWORD      biSize;
        LONG       biWidth;
        LONG       biHeight;
        WORD       biPlanes;
        WORD       biBitCount;
        DWORD      biCompression;
        DWORD      biSizeImage;
        LONG       biXPelsPerMeter;
        LONG       biYPelsPerMeter;
        DWORD      biClrUsed;
        DWORD      biClrImportant;
} BITMAPINFOHEADER;
        int i,j;

         FILE *fp;
        BITMAPFILEHEADER bfh;
        BITMAPINFOHEADER bif;
int color[16]={0,4,2,6,1,5,3,7,8,12,10,14,9,13,11,15};
        unsigned char rgb[64]={0,0,0,0,0,0,128,0,0,128,0,0,0,128,128,0
          ,128,0,0,0,128,0,128,0,128,128,0,0,128,128,128,0
          ,192,192,192,0,0,0,225,0,0,255,0,0,0,255,255,0
          ,255,0,0,0,255,0,255,0,255,255,0,0,255,255,255,0};
      union
        {
                unsigned char value;
            struct
            {
                        unsigned c1:4;
                        unsigned c2:4;

                }color;
        }mycolor;
         bfh.bfType=0x4d42;
    bfh.bfSize=153718;
    bfh.bfReserved1=0;
    bfh.bfReserved2=0;
    bfh.bfOffBits=118;
    bif.biSize=40;
    bif.biWidth=640;
    bif.biHeight=480;
    bif.biPlanes=1;
    bif.biBitCount=4;
    bif.biCompression=0;
    bif.biSizeImage=0;
    bif.biXPelsPerMeter=0;
    bif.biYPelsPerMeter=0;
    bif.biClrUsed=0;
    bif.biClrImportant=0;
     fp=fopen(fn,"wb";
fwrite(&bfh,sizeof(bfh),1,fp);
    fwrite(&bif,sizeof(bif),1,fp);
    fwrite(rgb,sizeof(rgb),1,fp);
for(j=479;j>=0;j--){
     for(i=0;i<640;i+=2){
    mycolor.color.c2=color[getpixel(i,j)];
    mycolor.color.c1=color[getpixel(i+1,j)];

      putc(mycolor.value,fp);
     }
     }

fclose(fp);

}
行动大于心动~~~
3楼2009-05-13 21:46:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 guoyaqun00 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 一志愿武汉理工,总分321,英一数二,求老师收留。 +7 nnnnnnn5 2026-03-25 7/350 2026-03-29 00:32 by 我是小康
[考研] 085600,专业课化工原理,321分求调剂 +4 大馋小子 2026-03-28 4/200 2026-03-29 00:32 by 544594351
[考研] 复试调剂 +3 raojunqi0129 2026-03-28 3/150 2026-03-28 15:27 by 落睿可思
[考研] 346求调剂 一志愿070303有机化学 +3 萝卜炖青菜 2026-03-28 3/150 2026-03-28 14:11 by 唐沐儿
[考研] 0703化学求调剂 +9 奶油草莓. 2026-03-22 10/500 2026-03-28 13:30 by 唐沐儿
[考研] 299求调剂 +7 嗯嗯嗯嗯2 2026-03-27 7/350 2026-03-28 13:09 by 唐沐儿
[考研] 291求调剂 +15 hhhhxn.. 2026-03-23 21/1050 2026-03-28 11:26 by self2008
[考研] 086000调剂 +3 7901117076 2026-03-26 3/150 2026-03-27 21:34 by Jianing_Mi
[考研] 材料与化工085600,总分304,本科有两篇sci参与,求调剂 +10 幸运的酱酱 2026-03-22 12/600 2026-03-27 16:08 by muchong357
[考研] 一志愿北京化工大学 070300 学硕 336分 求调剂 +9 vv迷 2026-03-22 9/450 2026-03-27 15:59 by 不吃魚的貓
[硕博家园] 北京林业大学硕导招生广告 +6 kongweilin 2026-03-26 8/400 2026-03-27 10:18 by FF_16
[考研] 一志愿陕师大生物学071000,298分,求调剂 +5 SYA! 2026-03-23 5/250 2026-03-27 09:29 by 不吃魚的貓
[考研] 317求调剂 +7 蛋黄咸肉粽 2026-03-26 7/350 2026-03-27 02:29 by fmesaito
[考研] 351求调剂 +4 麦克阿磊 2026-03-24 4/200 2026-03-27 00:32 by wxiongid
[考研] 求调剂 一志愿 本科 北科大 化学 343 +6 13831862839 2026-03-24 7/350 2026-03-26 22:57 by 不吃魚的貓
[考研] 297求调剂 +6 田洪有 2026-03-26 6/300 2026-03-26 15:55 by 不吃魚的貓
[考研] 一志愿 南京邮电大学 288分 材料考研 求调剂 +3 jl0720 2026-03-26 3/150 2026-03-26 13:39 by zzll406
[考研] 网络空间安全0839招调剂 +4 w320357296 2026-03-25 6/300 2026-03-25 17:59 by 255671
[考研] 0854电子信息求调剂 324 +4 Promise-jyl 2026-03-23 4/200 2026-03-25 11:36 by Sugarlight
[考研] 333求调剂 +3 ALULU4408 2026-03-23 3/150 2026-03-23 19:04 by macy2011
信息提示
请填处理意见