I basically need to write a program that will display all images in a directory, sequentially, and either create or open an existing corresponding text file, and allow a user to write/dictate into it.
(e.g. So working in a directory containing one.tif, two.tif and three.tif, the program will open/create one.txt, two.txt and three.txt and allow the user to append data at each iteration.)

I've already got a bash script that creates the .txt files but it's not much use, because there's so many images that it looks like the whole process will have to be automated.

My main problems are:
1) How do I open up each image file, sequentially, without knowing the name of the image file beforehand, and without knowing the amount of images in the directory?
2) How do I store the extensionless name of the file as a string within the program? (It's possible in shell scripting, but I can't find any C++ info)

I was looking at the boost.org libraries, but they look so difficult and I've got very little experience with OOP.. :(
For the image part, I found a nice library, CImg, with which it's pretty easy to display images in a window..

Should I just try to get to grips with the above two libraries? Or should I figure out how to use Visual Studio to do it?
I'm really lost, and I only have like a week to do this.. thanks for any suggestions..

um a not very good solution is to ls to a file, read the file and operate on it.

> Or should I figure out how to use Visual Studio to do it?
Visual Studio won't do it for you since its an IDE, not a language. Standard C++ has no inbuilt support for GUI, Networking and the likes. You have to resort to third party libraries.

> Should I just try to get to grips with the above two libraries?
Considering your project deadline, making use of premade libraries would be a wise choice. They would drastically reduce your development time.

As for the part about randomly choosing an image, you can iterate through the contents of the directory using Boost libraries, so it shouldn't be a problem as such.

> Or should I figure out how to use Visual Studio to do it?
>> Visual Studio won't do it for you since its an IDE, not a language. Standard C++ has no inbuilt support for GUI, Networking and the likes. You have to resort to third party libraries.
I am sure you should be able to find one of the Active-X component in the visual studio that will display an image.
Like SOS said there is no support in std C++ for such graphics.
In any case I think it would be easiest to use one of MS Active-X.
In case you're not familiar with VC++, you need to
- go to the resource view
- add a dialog box
- add a custom control to this dialog box
- right click and select/associate correct Active-X component with it.
Also I vaguely remember that one of the std control is an image, and it should be possible to programetically change the image at run-time. This could be second option if I'm right. :).

Also you should be able to find lotsa threads in C and C++ forums that tell you how to get the list of all files in a directory, that solve the other problem

This is exactly what I was looking for:
http://www.daniweb.com/code/snippet370.html
I think it would be easy enough to embed that using the CImg library.. I can't wait.. ^^

Thanks everyone,

Umm... I'll keep you posted on my progress (if anyone cares).. maybe you can give me some feedback..
This is like part of a summer project for college..

(if anyone cares)..

Sure ! Everyone will be interested as long it's interesting.. :)

...and as long as the code works when copy pasted.

;-)

Hi again,
I'm making good progress with this.. (and can post the code if you want).
At the moment this is a win32 console application.. so it brings up a dos-prompt window and a "windows" window with the image, each iteration. Whenever you click on the image, a new image pops up, until all images have been viewed..

So it kinda works like this:

store extensions of images in vector;
browse specified root directory and all subdirs for all files;
    => store results in a list of vectors;

for (all files stored in all vectors in list of vectors)
    for (all extns stored in vector of extns)
        if (extn from list matches extn from extn-vector)
            display image + [B]do whatever[/B] ;

create a logfile of events;

But obviously the task is to annotate each image as the cycle goes on.. this annotation process would be some sort of code which will be inserted into the "do whatever" bit..
Oh, I should also mention that ultimately this program will be dictated into, with a microphone and a program called Dragon Naturally Speaking. So I'm pretty sure that simple cin's are out of the question because you can't dictate into a console window.. I'm going to need something which possibly opens wordpad and allows me to dictate into it in real time..

So.. just curious what you would do next.. should I look into MFC classes? Windows forms? Is there some library that allows me to open wordpad or something like this?
Or am I totally off the wall, and there is totally different method?

Obviously I'm not looking for code or anything.. just some starting ground so I don't waste my precious time.. I have four days left to do this.. :)

Cheers!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.