当前位置: 首页>>代码示例>>C++>>正文


C++ FileIO::GetFileContents方法代码示例

本文整理汇总了C++中FileIO::GetFileContents方法的典型用法代码示例。如果您正苦于以下问题:C++ FileIO::GetFileContents方法的具体用法?C++ FileIO::GetFileContents怎么用?C++ FileIO::GetFileContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileIO的用法示例。


在下文中一共展示了FileIO::GetFileContents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main() {
    Couting couting;
    FileIO file;
    string text = file.GetFileContents("staff_ghost_time.bin");
    if (text.size()==0) {
        cout << "Fggt" << endl;
        return 0;
    }
    else {
            
    //Separating string to signs to reverse it
    string array[160];

    	for (int a=0; a<160; a++) {
        array[a]=text.substr(a, 1);
    	}
    
    string convertedarray[40];
    int array2[40][4];
    long long finalarray[40];
    for (int i=0; i<40; i++) {
    		//Reversing value and final string
    		convertedarray[i] = array[i*4+3] + array[i*4+2] + array [i*4+1] + array [i*4];
        for (int f=0; f<4; f++) {
            //String into int
            array2[i][f]=convertedarray[i][f];
            //If string was bigger than 127, give it a value to 255;
            if (array2[i][f]<0) {
                array2[i][f]=array2[i][f]+256;
            }
        }
        //Final time value
        finalarray[i] = array2[i][3]+array2[i][2]*256+array2[i][1]*65536;
    	}
    	
    	cout << "Staff_Ghost_Time.bin editor by Szymbar15, 2014\nCreated for DSHack.org community\[email protected]\n*****************\nVersion 1.2\nDo you want to see some hints on tool usage? \nType \"y\" if you want or anything else if you don\'t: ";
    	char c;
    	cin >> c;
    	if (c == 'y') {
        couting.CourseList();
    	}
    
    	int y;
        while (y != 41) {
            cout << "\n*****************\nWrite a number from 1 to 40 to load your desired course \nor write 41 to save changes and finish program: ";
            cin >> y;
            
            if (y <= 40) {
                cout << "\nThe current value for this track is: \n"
                    << finalarray[y-1] << " miliseconds, "
                    << finalarray[y-1]/1000 <<
                    " seconds.\nWrite new value in miliseconds smaller than 16777216: ";
                cin >> finalarray[y-1];
                cout << "\nSuccesfully changed!\nYour new value is: "
                    << finalarray[y-1] << " miliseconds, " << finalarray[y-1]/1000 << " seconds.\n\n";
            }
            
            else if (y > 41) {
                cout << "\nWrong number.\n";
            }
        }
开发者ID:szymbar15,项目名称:MarioKart-Tools,代码行数:61,代码来源:Staff_Ghost_Time_Editor.cpp


注:本文中的FileIO::GetFileContents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。