Hi all. I am trying to write a little program where I extract some
data out of a game in real time. The game writes some info to a log
file, and I can access this in real time. The problem is that the log
name is (partially) new every time so I can't just open any file.
Currently I have to first start the log, then copy the log name to my c
++ source file (fopen(logname)), then compile the source file and
after that run the extracting program, at which time the log has grown
a substantial amount.
What I want to do is just start the log and then start the extracting
program and it'll find the new logfile right away.
Good to know:
I can set the first part of the name manually. The game adds date and
time to it so the logfile name is e.g.:
mylogname_070208_180914.log
I can see two ways of solving this: Either search for the newest files
in the folder the log is created in, or open a file that starts with
"mylogname".
Anyone have a solution to this?
current code:
FILE *fileP; //fileP = file pointer
fileP = fopen("mylogname_070208_172648.log","r"); //bad code have to
copy paste every time 5 1762 tc*******@hotmail.com wrote:
Hi all. I am trying to write a little program where I extract some
data out of a game in real time. The game writes some info to a log
file, and I can access this in real time. The problem is that the log
name is (partially) new every time so I can't just open any file.
Currently I have to first start the log, then copy the log name to my c
++ source file (fopen(logname)), then compile the source file and
after that run the extracting program, at which time the log has grown
a substantial amount.
What I want to do is just start the log and then start the extracting
program and it'll find the new logfile right away.
Good to know:
I can set the first part of the name manually. The game adds date and
time to it so the logfile name is e.g.:
mylogname_070208_180914.log
I can see two ways of solving this: Either search for the newest files
in the folder the log is created in, or open a file that starts with
"mylogname".
Anyone have a solution to this?
There is no solution in standard C++. The closest you can get is by using
the boost filesystem library.
current code:
FILE *fileP; //fileP = file pointer
fileP = fopen("mylogname_070208_172648.log","r"); //bad code have to
copy paste every time
One improvement would be to take the name as a command line argument. That
way, at least you don't need to recompile your program each time the file
name changes. tc*******@hotmail.com wrote:
Hi all. I am trying to write a little program where I extract some
data out of a game in real time. The game writes some info to a log
file, and I can access this in real time. The problem is that the log
name is (partially) new every time so I can't just open any file.
Currently I have to first start the log, then copy the log name to my c
++ source file (fopen(logname)), then compile the source file and
after that run the extracting program, at which time the log has grown
a substantial amount.
What I want to do is just start the log and then start the extracting
program and it'll find the new logfile right away.
Good to know:
I can set the first part of the name manually. The game adds date and
time to it so the logfile name is e.g.:
mylogname_070208_180914.log
I can see two ways of solving this: Either search for the newest files
in the folder the log is created in, or open a file that starts with
"mylogname".
Anyone have a solution to this?
current code:
FILE *fileP; //fileP = file pointer
fileP = fopen("mylogname_070208_172648.log","r"); //bad code have to
copy paste every time
Maybe something in the Boost Filesystem library can help, but I haven't
had to use it yet: http://www.boost.org/libs/filesystem/doc/index.htm
--
Marcus Kwok
Replace 'invalid' with 'net' to reply
I just had an idea... Although I don't know the exact filename I do
know the length of the filename. Anyway I can use this to make it
easier? (I'm thinking if I can list att files in a folder and make
sure this is the only file of specific length I can open it with a
simple if command.)
The boost filesystem library does not seem to have the desired command.
<tc*******@hotmail.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
Hi all. I am trying to write a little program where I extract some
data out of a game in real time. The game writes some info to a log
file, and I can access this in real time. The problem is that the log
name is (partially) new every time so I can't just open any file.
Currently I have to first start the log, then copy the log name to my c
++ source file (fopen(logname)), then compile the source file and
after that run the extracting program, at which time the log has grown
a substantial amount.
What I want to do is just start the log and then start the extracting
program and it'll find the new logfile right away.
Good to know:
I can set the first part of the name manually. The game adds date and
time to it so the logfile name is e.g.:
mylogname_070208_180914.log
I can see two ways of solving this: Either search for the newest files
in the folder the log is created in, or open a file that starts with
"mylogname".
Anyone have a solution to this?
current code:
FILE *fileP; //fileP = file pointer
fileP = fopen("mylogname_070208_172648.log","r"); //bad code have to
copy paste every time
You need something to get a list of files in the directory. Either use
Boost or something from your own OS. For windows look at findfirst() and
findnext() (_findfirst() and _findnext()). Not sure for *nix. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ryanmhuc |
last post by:
I know the subject might be confusing. I am no beginner with
javascript but I haven't been able to figure out how to get the
javascript file name from code inside the file. So you have an HTML...
|
by: Wayne Aprato |
last post by:
I am using code kindly provided by the Access Web to capture a file
path and insert it into a form. The relevant part of the code follows:
Function GetOpenFile(Optional varDirectory As Variant,...
|
by: Tor Inge Rislaa |
last post by:
Finding name and type
In the activate procedure of a form I want to write to the debug window,
name and type of all controls at that actual form. Is there a smart way to
do that?
Allso for...
|
by: Tor Inge Rislaa |
last post by:
Finding name of all forms
I want to create a procedure that can loop trough all objects of type form
in an application and print the name property to the debug window.
TIRislaa
|
by: walterbyrd |
last post by:
I am trying to develop an app where: the same file, in the same place,
will be uploaded, and then processed.
Everything I can find about uploading a file, uses a form that requires
the user to...
|
by: =?Utf-8?B?Qkw=?= |
last post by:
Hello friends
In c# 2005 I have written a function to access "font file name" by "Font
name" and it is working fine in all the windows version other than vista,
in vista it is throughing an...
|
by: carmelo |
last post by:
Hi! I need to read and store data from a file, but I don't the name of
it; Is this code correct and is there a better way to do this thing??
int main()
{
cout << " type file name:"
char *...
|
by: jacob navia |
last post by:
Hi
We are rewriting the libc for the 64 bit version of lcc-win
and we have added a new field in the FILE structure:
char *FileName;
fopen() will save the file name and an accessor function
will...
|
by: liberty1 |
last post by:
Hi everyone. I appreciate your effort at helping newbies like me. I have the following problems and will appreciate urgent help.
PROBLEM NUMBER 1:
Using PHP and MySQL, I am able to upload...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |