Bir Java uygulaması acalım daha sonra bir txt dosyası olusturalım ıcıne bırseyler yazalım. Txt dosyamızı kaydedelim ve NetBeans project altında, projemizin adının bulundugu klasorun ıcıne dosyayı atalım.
Gerekli Kütüphaneler;
Kod: Kodu kopyalamak için üzerine çift tıklayın!
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
Java main class ımızın içine aşağıdaki kod bloğunu yazalım;
Kod: Kodu kopyalamak için üzerine çift tıklayın!
try
{
FileInputStream in = new FileInputStream("inputFile.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while((strLine = br.readLine())!= null)
{
System.out.println(strLine);
}
}catch(Exception e){
System.out.println(e);
}
}
Sonuç txt içinde bulunan opengl kodlarını satır satır okumalı;
PHP Kod: Kodu kopyalamak için üzerine çift tıklayın!
#include "stdafx.h"
// Bounce.c
// Demonstrates a simple animated rectangle program with GLUT
// OpenGL SuperBible, 2nd Edition
// Richard S. Wright Jr.
include <windows.h>
#include "glut.h"
// Initial square position and size
GLfloat x1 = 100.0f;
GLfloat y1 = 150.0f;
GLsizei rsize = 50;
// Step size in x and y directions
// (number of pixels to move each time)
GLfloat xstep = 1.0f;
GLfloat ystep = 1.0f;
// Keep track of windows changing width and height
GLfloat windowWidth;
GLfloat windowHeight;
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
//
BUILD SUCCESSFUL (total time: 1 second)