本文整理汇总了C++中file::open方法的典型用法代码示例。如果您正苦于以下问题:C++ file::open方法的具体用法?C++ file::open怎么用?C++ file::open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file
的用法示例。
在下文中一共展示了file::open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnStartCapture
//This function is called when a new capture is started
//"block" holds an object representing the current script block on the flowchart
//Type "block." for a list of available functions for use in the script
void OnStartCapture(ScriptBlock block)
{
block.ClearOutputText(); //Clear this script's output window
block.PrintOutputText("Binary file write started\n", false, false, false, false); //Print to the output window
//Open the firmware image file
int ret = handle.open(FIRMWARE_FILE_NAME, "rb");
if (ret != 0) {
block.PrintOutputText("Failed to open firmware image: \"" + FIRMWARE_FILE_NAME + "\"\n", true, false, false, true);
bFileOpen = false; //mark file as not open
} else {
block.PrintOutputText("Sending contents of \"" + FIRMWARE_FILE_NAME + "\" onto the CAN bus\n", false, false, false, true);
bFileOpen = true; //mark file as open
}
}
示例2:
random_generator ()
{ file_.open ("/dev/urandom", std::ios_base::binary | std::ios_base::in); }