Z racji tego ze nie znam sie na programowaniu, chciałem zapytac czy ktos zna program/moze napisac który
By czytal plik txt na przykladzie
Kod :
A
4 sec przerwy
B
4 sec przerwy
C
Pozdrawiam
A
4 sec przerwy
B
4 sec przerwy
C
#include <stdio.h>
#include <conio.h>
#include <windows.h>
using namespace std;
int main()
{
FILE *file = new FILE();
file = fopen("dane.txt", "r");
char *line = new char[1024];
while (!feof(file))
{
fgets(line, strlen(line), file);
printf("%s", line);
Sleep(4000);
}
fclose(file);
getch();
return 0;
}
#include <fstream>
#include <string>
#include <iostream>
#include <conio.h>
#include <Windows.h>
using namespace std;
int main()
{
ifstream infile("dane.txt");
string line;
while (infile >> line)
{
cout << line << endl;
Sleep(4000);
}
getch();
return 0;
}
Ostatnio zmieniony przez bercik : 10-02-2014, 16:25
Kontakt ze mną:
pw
Aktualnie 1 użytkowników przegląda ten temat. (0 użytkowników i 1 gości)
Zakładki