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


C++ Text::checkHead方法代码示例

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


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

示例1: main

int main() {
    int choice;
    Text tobj;
    JPEG jobj;
    MP3 mobj;
    BMP bobj;
    cout<<"\n\n";
    cout<<"\t\t\tIMAGE STEGANOGRAPHY"<<endl<<endl;
    cout<<"\tDo you want to \n\t1. Embed Data\n\t2. Extract Data"<<endl;
    cout<<"\n\tEnter choice :: ";
    cin>>choice;
    system("cls");
    cout<<"\n\n";
    cout<<"\t\t\tIMAGE STEGANOGRAPHY"<<endl<<endl;
    
    switch(choice){
        case 1: cout<<"\t1. Embed Text.\n\t2. Embed JPEG Image.\n\t3. Embed MP3 file."<<endl;
                cout<<"\n\tEnter choice :: ";
                cin>>choice;
                system("cls");
                cout<<"\n\n";
                cout<<"\t\t\tIMAGE STEGANOGRAPHY"<<endl<<endl;
                if ( !bobj.getInputfile() )
                    cout<<"\tInvalid file name."<<endl;
                else {
                    if( !bobj.checkFile() )
                        cout<<"\tNot a BMP image."<<endl;
                    else {
                        bobj.setlength();
                        switch(choice){
                            case 1: bobj.getOutputfile();
                                    bobj.byepassHeader();
                                    tobj.getData();
                                    tobj.openStream();
                                    tobj.embedHeader(bobj);
                                    tobj.embedData(bobj);
                                    tobj.embedTrailer(bobj);
                                    tobj.embedRest(bobj);
                                    cout<<"\n\tText successfully embedded to \"output.bmp\"."<<endl;
                                    cout<<"\tThe file can be found in the current folder."<<endl;
                                    break;
                            case 2: jobj.getData();
                                    if ( !jobj.checkFile() )
                                        cout<<"\tNot a JPEG file."<<endl;
                                    else {
                                        if ( !jobj.checkLength(bobj) )
                                            cout<<"\tFile too large to be embedded."<<endl;
                                        else {
                                            bobj.getOutputfile();
                                            bobj.byepassHeader();
                                            jobj.embedHeader(bobj);
                                            jobj.embedLength(bobj);
                                            jobj.embedData(bobj);
                                            jobj.embedRest(bobj);
                                            cout<<"\n\tJPEG file successfully embedded to \"output.bmp\"."<<endl;
                                            cout<<"\tThe file can be found in the current folder."<<endl;
                                        }
                                    }
                                    break;
                            case 3: mobj.getData();
                                    if( !mobj.checkFile() )
                                        cout<<"\tNot a MP3 file!"<<endl;
                                    else {                                                                      
                                        if( !mobj.checkLength(bobj) )
                                            cout<<"\tFile too large to be embedded."<<endl;
                                        else {
                                            bobj.getOutputfile();
                                            bobj.byepassHeader();
                                            mobj.embedHeader(bobj);
                                            mobj.embedLength(bobj);
                                            mobj.embedData(bobj);
                                            mobj.embedRest(bobj);
                                            cout<<"\n\tMP3 file successfully embedded to \"output.bmp\"."<<endl;
                                            cout<<"\tThe file can be found in the current folder."<<endl;
                                        }
                                    }
                                    break;
                            default: if (choice != 1 || choice != 2 || choice != 3 )
                                         cout<<"\tInvalid choice."<<endl;
                                     break;
                            }        // End of switch
                            bobj.closefiles();
                        }        // End of else
                }
                break;
                       
                case 2: cout<<"\t1. Extract Text.\n\t2. Extract JPEG Image.\n\t3. Extract MP3 file."<<endl;
                        cout<<"\n\tEnter choice :: ";
                        cin>>choice;
                        system("cls");
                        cout<<"\n\n";
                        cout<<"\t\t\tIMAGE STEGANOGRAPHY"<<endl<<endl;
                        switch(choice){
                            case 1: if ( tobj.setHead() )
                                        if (  tobj.checkHead() )
                                            tobj.extractData();
                                    getch();
                                    cout<<"\n\n\tPress any key to exit...";
                                    break; 
                            case 2: if ( jobj.setHead() )
//.........这里部分代码省略.........
开发者ID:divyanshm,项目名称:Stego,代码行数:101,代码来源:compiled.cpp


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