int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); std::string FirstString; std::string SecondString; std::ifstream InputFile("C:/games/input.txt"); int HamingDistance = 0; std::getline(InputFile, FirstString); std::getline(InputFile, SecondString); std::string::iterator SecondIter = SecondString.begin(); for (std::string::iterator FirstIter = FirstString.begin(); FirstIter != FirstString.end(); ++FirstIter) { if ( *FirstIter != *SecondIter ) { ++HamingDistance; } ++SecondIter; } std::cout<< HamingDistance << std::endl; return a.exec(); }
TChain * CreateChainFromList_opt(std::string ListFileName, std::string BaseDirectory, std::string ChainName, bool DoCheck) { ifstream InputFile(ListFileName.c_str()); std::string FileName; TChain * TheChain = new TChain(ChainName.c_str()); if(!DoCheck) { while(getline(InputFile, FileName)) { FileName=BaseDirectory+FileName; std::cout<<FileName.c_str()<<std::endl; TheChain->Add(FileName.c_str()); } } else { while(getline(InputFile, FileName)) { FileName=BaseDirectory+FileName; TFile*f=TFile::Open(FileName.c_str()); if(f->Get(ChainName.c_str())) { std::cout<<FileName.c_str()<<std::endl; TheChain->Add(FileName.c_str()); } else std::cout<<"Chain " <<ChainName << " not found in file " << FileName<<std::endl; } } return TheChain; }
//------------------------------------------------------------------------------ /// \brief Private virtual function that actually does the conversion //------------------------------------------------------------------------------ bool ProcessorMNW2::DoConvertFile () { return(m_p->DoConvertFile(InputFile(), OutputFile(), NumRow(), NumCol())); } // ProcessorMNW2::DoConvertFile
// Init void Object::Init (char* FileName) { //init PolyList KillPolyList(); ifstream InputFile(FileName); assert(InputFile); const int BUFSIZE = 256; char buf[BUFSIZE]; while (InputFile.getline(buf, BUFSIZE)) { std::istringstream line(buf); char function[BUFSIZE]; char throwaway[BUFSIZE]; char strval[BUFSIZE]; float fval1, fval2, fval3, fval4; line >> function; line >> throwaway; if (strcmp(function, "shape") == 0) { line >> strval; fval1 = fval2 = fval3 = fval4 = 0.0f; if (strcmp(strval, "QUADS") == 0) { AddPolyList(SHAPE, QUADS, fval1, fval2, fval3, fval4); } if (strcmp(strval, "TRIANGLES") == 0) { AddPolyList(SHAPE, TRIANGLES, fval1, fval2, fval3, fval4); } } else {
int main(int argc, char * argv[]){ FILE *ifp,*ofp; if(argc > 3 || argc < 2) report_exit("error: command inputfile"); ifp = fopen(argv[1], "r") ; ofp = fopen(argv[2], "w") ; if( InputFile(ifp) != 1 ) report_exit("Error reading file"); char buf[80]; int i; FILE * pFig = fopen("cluster.fig","w"); // start to test preprocess_block(&blockage); preprocess_sinks(&sink); construct_g_all(&blockage,&sink); all_pair_shortest(); cluster_sinks(&blockage,&sink); draw_case(pFig); draw_link_sink(pFig); free_clusters(); free_all(); return 0; }
// ----------------------------------------------------------------------- bool TProcessor::processFile(const QString &Input_, const QString &Output_) { QFile InputFile(Input_); if(!InputFile.open(QIODevice::ReadOnly | QIODevice::Text)) { std::cerr << "Can't open file: '" << (const char*)Input_.toLocal8Bit() << "'."; return false; } // QFile OutputFile(Output_); if(!OutputFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { std::cerr << "Can't open output file: '" << (const char*)Output_.toLocal8Bit() << "'."; return false; } // while(true) { TResult Result = findOperator(InputFile, OutputFile, true); if(Result == ResultSyntaxError) { // The error message was provided by the callee. return false; } else if(Result == ResultReadError) { std::cerr << "Can't read file: '" << (const char*)Input_.toLocal8Bit() << "'. Possible it is not in UTF-8 encoding."; return false; } else if(Result == ResultWriteError) { std::cerr << "Can't write data to file: '" << (const char*)Output_.toLocal8Bit() << "'."; return false; } else { assert(Result == ResultOK || Result == ResultEOF); return true; } } }
void CEnvironment::_configureProfile ( void ){ /* Read profile from file */ ifstream InputFile ( m_sSourceFile.c_str() ); m_vInputProfile.clear ( ); float tmp_float, tmp_float_old, slope; InputFile.ignore ( 256, ' ' ); InputFile.ignore ( 256, ' ' ); InputFile.ignore ( 256, ' ' ); InputFile.ignore ( 256, ' ' ); InputFile.ignore ( 256, ' ' ); InputFile >> tmp_float_old; tmp_float_old *= m_fAmplitude; InputFile.ignore ( 256, '\n' ); while ( !InputFile.eof() ){ InputFile.ignore ( 256, ' ' ); InputFile.ignore ( 256, ' ' ); InputFile.ignore ( 256, ' ' ); InputFile.ignore ( 256, ' ' ); InputFile.ignore ( 256, ' ' ); InputFile >> tmp_float; tmp_float *= m_fAmplitude; slope = (tmp_float - tmp_float_old)/60.0; for ( int j = 0 ; j < 60 ; j++ ){ m_vInputProfile.push_back( tmp_float_old + slope * j ); } InputFile.ignore ( 256, '\n' ); tmp_float_old = tmp_float; } InputFile.close(); return; };
/** * * Loads the contents of a board from a text file. * * \param [in] Filename * Path to the file to read from. * * \return * true if the function succeeds or false otherwise. * */ bool Board::LoadFromFile(const char* Filename) { std::ifstream InputFile(Filename); if( ! InputFile) { return false; } int Rows = 0; int Cols = 0; if( ! GetBoardDimensionsFromFile(InputFile, Rows, Cols)) { return false; } Cell ** ppNewBoard = AllocateNewBoard(Rows, Cols); if( ! ppNewBoard) { return false; } ReadBoardFromFile(InputFile, ppNewBoard); // Free the old contents of the board (if any) FreeBoard(ppBoard, RowsCount); ppBoard = ppNewBoard; RowsCount = Rows; ColsCount = Cols; return true; }
void TextEditor::OpenFile(const QString FileLocation) { qApp->setOverrideCursor(Qt::WaitCursor); if (!FileLocation.isEmpty()) { QFile File(FileLocation); if (File.open(QFile::ReadOnly | QFile::WriteOnly | QFile::ReadWrite)) { QTextStream InputFile(&File); InputFile.setCodec("UTF-8"); setPlainText(InputFile.readAll()); QObject::connect(c, SIGNAL(activated(QString)), this, SLOT(insertCompletion(QString))); File.close(); Filename = FileLocation; SetupFile(); qApp->restoreOverrideCursor(); return; } QMessageBox::warning(this, Shared::Error, Shared::CannotReadFile.arg(FileLocation).arg(File.errorString())); qApp->restoreOverrideCursor(); return; } qApp->restoreOverrideCursor(); }
/** * @brief read shader code from resource repos. */ std::string ParticleSystem::readShaderCode(const char* fileName){ std::ifstream InputFile(fileName); if(!InputFile.good()){ std::cout<<"file failed to load..."<<fileName<<std::endl; exit(1); } return std::string( std::istreambuf_iterator<char>(InputFile), std::istreambuf_iterator<char>()); }
// ----------------------------------------------------------------------- bool ProcessFolder(const QString &Input_, const QString &Output_, TProcessor &Processor_) { QDir InputFolder(Input_); if(!InputFolder.exists()) { std::cerr << "Error accessing folder '" << (const char*)Input_.toLocal8Bit() << "'."; return false; } // QDir OutputFolder(Output_); if(!OutputFolder.exists()) { if(!OutputFolder.mkpath(Output_)) { std::cerr << "Can't create folder '" << (const char*)Output_.toLocal8Bit() << "'."; return false; } } // Processing files QStringList FilesList = InputFolder.entryList(QDir::Files | QDir::Hidden | QDir::System); for(QStringList::iterator it = FilesList.begin(); it != FilesList.end(); ++it) { QString InputFile(Input_ + *it), OutputFile(Output_ + *it); if(QFile::exists(OutputFile)) { if(!QFile::remove(OutputFile)) { std::cerr << "Can't write file '" << (const char*)OutputFile.toLocal8Bit() << "'."; return false; } } bool Result = Processor_.isExcluded(*it)? QFile::copy(InputFile, OutputFile): Processor_.processFile(InputFile, OutputFile); // if(!Result) { std::cerr << "Can't write file '" << (const char*)OutputFile.toLocal8Bit() << "'."; return false; } } // Processing folders FilesList = InputFolder.entryList(QDir::Dirs | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot | QDir::NoSymLinks); for(QStringList::iterator it = FilesList.begin(); it != FilesList.end(); ++it) { if(!ProcessFolder(Input_ + *it + QDir::separator(), Output_ + *it + QDir::separator(), Processor_)) return false; } return true; }
void Settings::Load(QString IFileName) { QFile InputFile(IFileName); InputFile.open(QIODevice::ReadOnly | QIODevice::Text); QDomDocument Document; Document.setContent(&InputFile); InputFile.close(); QDomElement Root = Document.documentElement(); QDomNode Node = Root.firstChild(); QDomElement Element; while(!Node.isNull()) { if(!((Element = Node.toElement()).isNull()) && Element.tagName()==XML_USER_TAG) UserList.append(User(&Element)); else QMessageBox::about(0,"ERROR!","NOT XML_USER_TAG"); Node=Node.nextSibling(); } }
bool ShaderManager::ItlLoadSourceFromFile(std::string sFilename, std::vector<char> &rvcSource) { // create input file stream std::ifstream InputFile(sFilename); // check if file is opened correctly bool bOk = InputFile.is_open(); assert (bOk); // read file in one call if (bOk) { // seek to end InputFile.seekg(0, std::ios::end); // get position (=size) long lSize = InputFile.tellg(); // seek to begin InputFile.seekg(std::ios::beg); // create buffer to read data content char *pBuffer = new char[lSize]; // read content InputFile.read(pBuffer, lSize); // reserve space in dest-vector rvcSource.reserve(lSize); // clear dest vector rvcSource.clear(); // copy content (todo: memcpy for faster acccess?) for (long i=0; i < lSize; i++) rvcSource.push_back(pBuffer[i]); } return bOk; }
/// @internal /// @brief This will open then parse the contents of the file specified by TempFile and interpret any test results located /// @throw This can throw any exception that the C++ filestream classes can throw. /// @return This "reads" the temp file and interprets it. It tries to extract the name of the test as the whole of a line minus /// the last word. The last word is then converted into a @ref TestResult using @ref StringToTestResult . Any Whitespace between /// between the end of the last word and the end of the test name is dropped. All lines are interpretted this way and returned /// as a single @ref UnitTestGroup. UnitTestGroup GetResultsFromTempFile() { UnitTestGroup Results; pugi::xml_document Doc; std::ifstream InputFile(TempFile.c_str()); pugi::xml_parse_result LoadResults = Doc.load(InputFile); if(LoadResults) { Results.AddTestsFromXML(Doc.first_child()); }else{ std::stringstream FailStream; FailStream << "Failure loading tempfile from SubProcess: " << LoadResults.description() << std::endl << "At " << LoadResults.offset << " bytes into the file."; throw runtime_error(FailStream.str()); } return Results; }
void main(void) { struct personal_data_format *sort_data; int k; if ( (Data = calloc( 100, sizeof( struct personal_data_format ) )) == NULL) { printf("Not allocate memory !\n"); exit(1); } if ( (sort_data = calloc( 100, sizeof( struct personal_data_format ) )) == NULL) { printf("Not allocate memory !\n"); exit(1); } InputFile(); if ( (k = Attest()) == 1 ) { printf("Error ! \n"); exit(1); } else if (k == 0) { printf("Welcome ! \n"); } MakeSortData( sort_data ); QuickSort( sort_data , 0 , Data_num - 1 ); OutputFile( sort_data ); free( Data ); free( sort_data ); }
int wmain(int argc, wchar_t* argv[]) { try { if( argc != 3 ) { throw swException(wstring_make() << "usage: input.obj output.gl" ); } wstring InputFileName = argv[1]; wstring OutputFileName = argv[2]; TriMesh mesh; cout << endl << "Loading: " << toNarrowString(InputFileName.c_str()).c_str() << endl; ObjFile InputFile(InputFileName, mesh); cout << endl << "Writing: " << toNarrowString(OutputFileName.c_str()) << endl; GLFile OutputFile(OutputFileName, mesh); return EXIT_SUCCESS; } catch(swException& e) { cout << toNarrowString(e.What()) << endl; } catch(exception& e) { cout << e.what() << endl; } catch(...) { cout << "unknown exception" << endl; } return EXIT_FAILURE; }
int main (int argc, const char * argv[]) { char* filePath = NULL; bool overwrite = false; ComponentDescription compDesc = {0, 0, 0, 0, 0}; AudioFileID inputFileID = 0; AudioFileID outputFileID = 0; CAStreamBasicDescription desc; AudioUnit theUnit = 0; setbuf (stdout, NULL); for (int i = 1; i < argc; ++i) { if (strcmp (argv[i], "-u") == 0) { if ( (i + 3) < argc ) { compDesc.componentType = str2OSType (argv[i + 1]); compDesc.componentSubType = str2OSType (argv[i + 2]); compDesc.componentManufacturer = str2OSType (argv[i + 3]); Component comp = FindNextComponent (NULL, &compDesc); if (comp == NULL) break; OpenAComponent (comp, &theUnit); i += 3; } else { printf ("Which Component:\n%s", usageStr); return -1; } } else if (strcmp (argv[i], "-f") == 0) { filePath = const_cast<char*>(argv[++i]); printf ("Input File:%s\n", filePath); } else if (strcmp (argv[i], "-o") == 0) { overwrite = true; } else { printf ("%s\n", usageStr); return -1; } } if (compDesc.componentType == 0) { printf ("Must specify AU:\n%s\n", usageStr); return -1; } if (theUnit == 0) { printf ("Can't find specified unit\n"); return -1; } if (filePath == NULL) { printf ("Must specify file to process:\n%s\n", usageStr); return -1; } OSStatus result = 0; if (result = InputFile (filePath, inputFileID)) { printf ("Result = %ld, parsing input file, exit...\n", result); return result; } UInt32 fileType; UInt32 size = sizeof (fileType); result = AudioFileGetProperty (inputFileID, kAudioFilePropertyFileFormat, &size, &fileType); if (result) { printf ("Error getting File Type of input file:%ld, exit...\n", result); return result; } size = sizeof (desc); result = AudioFileGetProperty (inputFileID, kAudioFilePropertyDataFormat, &size, &desc); if (result) { printf ("Error getting File Format of input file:%ld, exit...\n", result); return result; } if (desc.IsPCM() == false) { printf ("Only processing linear PCM file types and data:\n"); desc.Print(); return -1; } result = OutputFile (filePath, fileType, compDesc.componentSubType, overwrite, desc, outputFileID); if (result) { printf ("Error creating output file:%ld, exit...\n", result); return result; } // at this point we're ready to process return Process (theUnit, compDesc, inputFileID, desc, outputFileID); }
void RunFile (const CString &sFilespec, bool bNoLogo) { ALERROR error; CCodeChain &CC = g_pUniverse->GetCC(); CCodeChainCtx Ctx; // Verify the file CString sRunFile = sFilespec; if (!strEndsWith(sRunFile, CONSTLIT(".")) && pathGetExtension(sRunFile).IsBlank()) sRunFile.Append(CONSTLIT(".tlisp")); // Open the file CFileReadBlock InputFile(sRunFile); if (error = InputFile.Open()) { printf("error : Unable to open file '%s'.\n", sRunFile.GetASCIIZPointer()); return; } if (!bNoLogo) printf("%s\n", sRunFile.GetASCIIZPointer()); // Parse CString sInputFile(InputFile.GetPointer(0), InputFile.GetLength(), TRUE); CString sOutput; int iOffset = 0; while (true) { int iCharCount; ICCItem *pCode = Ctx.Link(sInputFile, iOffset, &iCharCount); if (pCode->IsNil()) break; else if (pCode->IsError()) { printf("error : %s\n", pCode->GetStringValue().GetASCIIZPointer()); Ctx.Discard(pCode); return; } iOffset += iCharCount; // Execute ICCItem *pResult = Ctx.Run(pCode); // Compose output if (pResult->IsIdentifier()) sOutput = pResult->Print(&CC, PRFLAG_NO_QUOTES | PRFLAG_ENCODE_FOR_DISPLAY); else sOutput = CC.Unlink(pResult); // Free Ctx.Discard(pResult); Ctx.Discard(pCode); } // Output result printf("%s\n", sOutput.GetASCIIZPointer()); }
void GenerateEffectImage (CUniverse &Universe, CXMLElement *pCmdLine) { CString sError; int i, j; // Input file CString sInput = pCmdLine->GetAttribute(CONSTLIT("input")); if (sInput.IsBlank()) { printf("Input file required.\n"); return; } // Output file (optional) CString sFilespec = pCmdLine->GetAttribute(CONSTLIT("output")); if (!sFilespec.IsBlank()) sFilespec = pathAddExtensionIfNecessary(sFilespec, CONSTLIT(".bmp")); // Load a resource file so that we can create a design load context CResourceDb Resources(CONSTLIT("Transcendence")); if (Resources.Open(DFOPEN_FLAG_READ_ONLY, &sError) != NOERROR) { printf("%s\n", (LPSTR)sError); return; } CExternalEntityTable *pEntities; if (Resources.LoadEntities(&sError, &pEntities) != NOERROR) { printf("%s\n", sError.GetASCIIZPointer()); return; } // Generate a list of effect render structures TArray<SEffectRender> Effects; // Load the input file CFileReadBlock InputFile(sInput); if (InputFile.Open() != NOERROR) { printf("Unable to open input file: %s\n", sInput.GetASCIIZPointer()); return; } // Parse the file CXMLElement *pRenderFile; if (CXMLElement::ParseXML(&InputFile, pEntities, &pRenderFile, &sError) != NOERROR) { printf("%s\n", sError.GetASCIIZPointer()); return; } // Keep track of the max cell size and frame count int cxCellWidth = 0; int cyCellHeight = 0; int iCellsPerEffect = 1; // Generate structures SDesignLoadCtx LoadCtx; LoadCtx.sResDb = Resources.GetFilespec(); LoadCtx.pResDb = &Resources; LoadCtx.bNoVersionCheck = true; for (i = 0; i < pRenderFile->GetContentElementCount(); i++) { CXMLElement *pRender = pRenderFile->GetContentElement(i); CXMLElement *pEffectDesc = pRender->GetContentElementByTag(CONSTLIT("Effect")); if (pEffectDesc == NULL) { printf("<Effect> tag required.\n"); return; } SEffectRender *pEffect = Effects.Insert(); // Parse the effect if (pEffect->pEffectCreator.LoadEffect(LoadCtx, CONSTLIT("none"), pEffectDesc, NULL_STR) != NOERROR) { printf("%s\n", LoadCtx.sError.GetASCIIZPointer()); return; } // Bind if (pEffect->pEffectCreator.Bind(LoadCtx) != NOERROR) { printf("%s\n", LoadCtx.sError.GetASCIIZPointer()); return; } // Create a painter pEffect->pPainter = pEffect->pEffectCreator->CreatePainter(); if (pEffect->pPainter == NULL) { printf("Unable to create painter.\n"); return; } // Render specs int cyHeight = pRender->GetAttributeIntegerBounded(CONSTLIT("height"), 0, -1, 128); int cxWidth = pRender->GetAttributeIntegerBounded(CONSTLIT("width"), 0, -1, 128); cxCellWidth = Max(cxCellWidth, cxWidth); cyCellHeight = Max(cyCellHeight, cyHeight); // Figure out how many animation cells pEffect->iLifetime = Max(1, pEffect->pEffectCreator->GetLifetime()); iCellsPerEffect = Max(iCellsPerEffect, pEffect->iLifetime); } // Create the resulting image CImageGrid Output; Output.Create(iCellsPerEffect * Effects.GetCount(), cxCellWidth, cyCellHeight); // Paint for (i = 0; i < Effects.GetCount(); i++) { SEffectRender *pEffect = &Effects[i]; SViewportPaintCtx Ctx; for (j = 0; j < pEffect->iLifetime; j++) { int x, y; Output.GetCellCenter(i * iCellsPerEffect + j, &x, &y); // Create a context Ctx.iTick = j; // Paint the effect pEffect->pPainter->Paint(Output.GetImage(), x, y, Ctx); // Update pEffect->pPainter->OnUpdate(); } } // Output OutputImage(Output.GetImage(), sFilespec); }
void WordGenerator (CXMLElement *pCmdLine) { int i; // Load input file CString sFilespec = pCmdLine->GetAttribute(CONSTLIT("input")); if (sFilespec.IsBlank()) { printf("ERROR: input filename expected.\n"); return; } CFileReadBlock InputFile(sFilespec); if (InputFile.Open() != NOERROR) { printf("ERROR: Unable to open file: %s\n", sFilespec.GetASCIIZPointer()); return; } // "Novel" means that we only generate words that are not // in the input file. bool bNovelWordsOnly = pCmdLine->GetAttributeBool(NOVEL_ATTRIB); // Build up a word generator CMarkovWordGenerator Generator; TMap<CString, DWORD> InputWords; // Read each line of the file char *pPos = InputFile.GetPointer(0); char *pEndPos = pPos + InputFile.GetLength(); while (pPos < pEndPos) { // Skip whitespace while (pPos < pEndPos && (strIsWhitespace(pPos) || *pPos < ' ')) pPos++; // Parse the line char *pStart = pPos; while (pPos < pEndPos && *pPos != '\r' && *pPos != '\n' && *pPos >= ' ') pPos++; CString sWord(pStart, pPos - pStart); // Add the word to the generator if (!sWord.IsBlank()) { Generator.AddSample(strTrimWhitespace(sWord)); // If we are looking for novel words we need to keep a map // of all words in the input file. if (bNovelWordsOnly) InputWords.Insert(sWord); } } // If we have a count, then output a list of random words int iCount; if (pCmdLine->FindAttributeInteger(COUNT_ATTRIB, &iCount)) { if (iCount > 0) { TArray<CString> Result; Generator.GenerateUnique(iCount, &Result); for (i = 0; i < Result.GetCount(); i++) if (InputWords.Find(Result[i])) { Result.Delete(i); i--; } Result.Sort(); for (i = 0; i < Result.GetCount(); i++) printf("%s\n", Result[i].GetASCIIZPointer()); } } // Otherwise, output the generator as XML else { CMemoryWriteStream Output; if (Output.Create() != NOERROR) { printf("ERROR: Out of memory.\n"); return; } if (Generator.WriteAsXML(&Output) != NOERROR) { printf("ERROR: Unable to output generator as XML.\n"); return; } Output.Write("\0", 1); printf(Output.GetPointer()); } }
int main(int argc,char *argv[]){ int i,j; Node node; Node *temp; Node *now; SpecialNode g; SpecialNode s; NodeList list; //printf("%c %c",argv[1],argv[2]); //printf("%d ",argc); s.x = atoi(argv[1]); s.y = atoi(argv[2]); //g.x = atoi(argv[3]); //g.y = atoi(argv[4]); //s.x = 1; //s.y = 1; g.x = 46; g.y = 22; if(InputFile(&list, &g, &s) == 0) { printf("Cannot Open File!"); exit(1); } SetStarValue(&list,&s); Display(&list); delay(4000); SetOverValue(&list,&g); Display(&list); delay(2000); SetValue(&list, &g, &s); now = &(list.node[s.x][s.y]); now->x = s.x; now->y = s.y; while(1) { now->openlist = close; for(i=now->y-1; i<=now->y+1; i++) { for(j=now->x-1; j<=now->x+1; j++) { if(j == now->x && i ==now->y) continue; if(list.node[j][i].num != '0' && list.node[j][i].openlist == none && list.node[j][i].num != '-' && list.node[j][i].num != '|' && list.node[j][i].num != '3' && list.node[j][i].num != '0' && list.node[j][i].num != '4' && list.node[j][i].num != 'E' && list.node[j][i].num != 'H' && list.node[j][i].num != 'C' && list.node[j][i].num != 'L' && list.node[j][i].num != '6' && list.node[j][i].num != 'I' && list.node[j][i].num != 'u' ) { cal(&node, now , g , i , j); Add_to_list(&(list.node[j][i]),node); list.node[j][i].link = now; } } } if(list.node[g.x][g.y].s != 0) break; temp = now; if(choose_next_now_node(&list,&now) == 0) { now = now->pre; if(now->x == s.x && now->y == s.y) { printf("Cannot Arrive destination!\n"); break; } continue; } else { now->pre = temp; } } OutputFile(&list,now); Display(&list); return 0; }