zoukankan      html  css  js  c++  java
  • C语言fprintf和fputs文件写,文件指针往下偏移

    #include "main.h"
    #include <stdio.h>
    #include <signal.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <limits.h>
    #include <signal.h>
    #include <string.h>
    #include <stdlib.h>
    
    int main()
    {
        short buf[480] = {0};
        int ret = -1;
        FILE* pwav = fopen("mymic.wav","wb"); // wb打开有会自动删除
        if( pwav== NULL)
        {
           printf("pwav is NULL
    ");
        }
        memset(buf,1,960);
       // sprintf(buf,"hello"); // strcpy和sprintf都可以
        strcpy((char*)buf,"world");
        //size_t ret = fwrite(buf,480*2,1,pwav);
        fprintf(pwav,"%s
    ","hello");  // 
    
        fprintf(pwav,"%s
    ","mygirl"); // 
    
        printf("ret is %d
    ",ret);
        fputs("www.baidu.com
    ",pwav); //  和 
    
        fputs("2020/9/18
    ",pwav);
        fflush(pwav); // 没有fflush 文件里面什么都没有
        getchar();
        fclose(pwav);
        for(;;);
        return 0;
    }
    

      

    一勤天下无难事。
  • 相关阅读:
    javaweb学习2
    javaweb学习1
    Java学习17
    python 正则表达式
    python 常用库
    python 常用内置函数
    python 函数高级功能
    python 正则表达式findall
    tcpdump
    安卓软件学习进度_1
  • 原文地址:https://www.cnblogs.com/nowroot/p/13689757.html
Copyright © 2011-2022 走看看