Hello Everybody I have an idea abt read one file content and write them on another file. Now suppose I have five(approx.) files within Directory(say d:\datafile\). I wish to read content of more than one files one by one and write those content on single file. I dont know exactly but there is function like getfilenext() or getnextfile() which returns information abt subsequent file. Pls suggest me someway to do this...Both C n C++ version will be preffered.
This is going to be somewhat OS dependent. What avenues have you explored (say, via Google) to date? Let me recommend the "Before you post a query" thread. It emphasizes the importance of information, in case you never happened to realize that importance on your own.
Seems like a lot of work in c when batch for this is much easier. create a batch file called combine.bat combine.bat d:\datafile\*.* d:\combined.txt Code: @if "%1" == "" goto usage @if "%2" == "" goto usage @echo combine %1 to %2 @if not exist %2 copy "empty.file" "%2" @for %%x in (%1) do copy /B "%2"+"%%x" "%2" goto exit :usage @echo Usage: combine.bat 'file to process (can include wild cards)' 'file name (can include directory to save to)' @echo e.g. combine.bat *.txt temp\combined.txt :exit
To copy single jpeg file I tried following way:- Code: char buffer[512]; int source,desti,bytes; source = open(m_sourcepath,O_RDONLY|O_BINARY); if(source==-1) { MessageBox("Unable to open " + m_sourcepath); exit(0); } desti = open(m_destinationpath,O_WRONLY|O_BINARY); if(desti==-1) { MessageBox("Unable to open " + m_destinationpath); exit(0); } while(1) { bytes = read(source,buffer,512); if(bytes>0) write(desti,buffer,bytes); else break; } close(source); close(desti); MessageBox("Copied"); Does it right way to copy jpeg file? Compiler is giving error "identifier not found" for read(), write(), open(), close(). which header file I forget to include. I have already iuncluded fcntl.h. Pls consider I am using Visual Studio 2003 and dialog based application for making this program. I dont prefer to use CFile.
Its Done..... I forget to include "io.h".. Thanks Shabir for FindFirstFile n FindNextFile. Now after including Find Function, I think My program will be ready