Customize the file name and saving directory
来源:互联网 发布:大数据降维 编辑:程序博客网 时间:2024/05/21 10:34
Some fragments of code for customizing the file name and saving directory.
Customizing the file name with index:
//Output the customized files into specified folderchar directory[15] = "cells";char fp[20];int cell_id = 1;//Specify the file name with index: "cell_id" in this caseint n = std::sprintf(fp, ".\\%s\\cell%d.obj", directory, cell_id);FILE *fn = fopen(fp, "w");//necessary operations for writing data into output filefclose(fn);
Another way is to use stringstream to cumtomize string variable:
sample code
#include <iostream>using namespace std;#include <sstream>#include <string>int main(){stringstream outstream;int i;i = 1;outstream << "subclass_" << i << ".obj";string filename = outstream.str();cout << filename << endl;return 0;}
- Customize the file name and saving directory
- 移动硬盘显示:the file or directory is corrupted and unreadable
- U盘:the file or directory is corrupted and unreadable
- U盘the file or directory is corrupted and unreadable
- File and directory.
- File and Directory Enumeration
- File and directory.
- linux file and directory
- file and directory
- Removing the trailing file name and backslash from a path
- Multiple process create and delete the same name file conflict
- java.lang.UnsatisfiedLinkError,(A file or directory in the path name does not exist.
- WinEdt “error saving the project file” 解决办法
- CTeX问题: error saving the project file
- How To Get Application Path,And How To Get The Path's Directory,File Name,And Type Info(如何得到运行程序的路径,以及如何得到路径的文件夹,文件名,以及类型等等信息)
- Relationship between java file name and the declared class name in it
- C++ Delete Directory and File
- Powershell with file and directory
- jms消息类型(转)
- 让Apache Shiro保护你的应用
- Windows下cocos2DX安卓开发环境配置
- Java基础代码实例 :在控制台中输出金字塔,这个金字塔是由左右对称的数字组成的。
- Linux 端口
- Customize the file name and saving directory
- 前台后台的的json数据交互
- 指针的概念
- 为iOS的弹出键盘(keyboard)加上隐藏按扭
- 面向对象基础
- Hibernate缓存复习
- Linq to xml操作XML
- ActionResult 返回类型
- AT89C51ED2 的EEPROM 读写操作总结