dev-cpp-users Mailing List for Dev-C++ (Page 131)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <A_B...@gm...> - 2005-05-19 23:20:32
|
Well, it's a little bit unconventional, but I check file existans in this way:
if(FILE* f = fopen("file", "r")){
fclose(f);
// file exists
...
}else{
// file doesn't exist
...
}
What speaks against this method ???
CU, Acki
|
|
From: <Mat...@Ve...> - 2005-05-19 18:02:48
|
Also when you open a stream, checking it like a boolean will fail if the
file open failed:
For example:
#include <ifstream>
#include <stdexcept>
...
ifstream foo;
if(!foo) throw runtime_error("Could not open file.");
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Farzan
Hajian
Sent: Friday, May 20, 2005 2:31 AM
To: dev...@li...
Subject: [Dev-C++] File Existence
Hi,
I'v written a small program which simulates the DOS command "type". The
program receives
a file name form the command line. I used "fail()" function to check
existence of the received
file. I have not used "ifstream" functions a lot and I want to know
whether this is the
proper way to do so or not.
There is another function called "bad()". Please tell me what kind of
errors it can detect.
I tried it in my program and it couldn't check existence of files.
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int main(int argc,char* arg[])
{
if(argc==2)
{
ifstream File(arg[1]);
char ch;
if(File.fail())
cout << "File not found!\n";
else
while(true)
{
File.get(ch);
if(File.eof())
break;
cout << ch;
}
}
system("pause>null");
}
Thanks.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
___________________________________________________________________
The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure. If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof. Thank you.
|
|
From: Robert A. <ral...@gm...> - 2005-05-19 13:00:15
|
Check out... http://www.cplusplus.com/ref/#libs Then look at fstream and the clear function( which actually sets/clears statuses).... Hope this helps, Robert On 5/20/05, Farzan Hajian <far...@ho...> wrote: > Hi, > I'v written a small program which simulates the DOS command "type". The > program receives > a file name form the command line. I used "fail()" function to check > existence of the received > file. I have not used "ifstream" functions a lot and I want to know > whether this is the > proper way to do so or not. > There is another function called "bad()". Please tell me what kind of > errors it can detect. > I tried it in my program and it couldn't check existence of files. >=20 > #include <iostream> > #include <fstream> > #include <cstdlib> >=20 > using namespace std; >=20 > int main(int argc,char* arg[]) > { > if(argc=3D=3D2) > { > ifstream File(arg[1]); > char ch; > if(File.fail()) > cout << "File not found!\n"; > else > while(true) > { > File.get(ch); > if(File.eof()) > break; > cout << ch; > } > } > system("pause>null"); > } >=20 > Thanks. >=20 >=20 > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_idt12&alloc_id=16344&opclick > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Farzan H. <far...@ho...> - 2005-05-19 09:31:51
|
Hi,
I'v written a small program which simulates the DOS command "type". The =20
program receives
a file name form the command line. I used "fail()" function to check =20
existence of the received
file. I have not used "ifstream" functions a lot and I want to know =20
whether this is the
proper way to do so or not.
There is another function called "bad()". Please tell me what kind of =20
errors it can detect.
I tried it in my program and it couldn't check existence of files.
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int main(int argc,char* arg[])
{
if(argc=3D=3D2)
{
ifstream File(arg[1]);
char ch;
if(File.fail())
cout << "File not found!\n";
else
while(true)
{
File.get(ch);
if(File.eof())
break;
cout << ch;
}
}
system("pause>null");
}
Thanks.
--=20
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
|
From: Per W. <pw...@ia...> - 2005-05-18 19:46:11
|
No, building null-separated character arrays using strxxx() functions
isn't non-standard. And the SHFileOperation() function isn't alone to make
use of this concept. Win32 have a quite large number of functions with
this interface.
However, null-separated character arrays have been used for parameter and
environment passing etc. since the C language was invented, and probably
in similar forms since long before.
It is 100% within the standard and 100% portable, even if it might be
slightly less than common to use. The same code is also directly portable
to wchar_t with corresponding changes to wcscpy(), wcscat(), ...
If you think about it: the normal use of strcat() is to replace the '\0'
at the end of the first string with a new null-terminated string. But when
the need is there, you are fully free to keep this extra '\0' in the
middle. printf() won't be able to print the string, but that is besides
the point. A character array is only a null-terminated text string if I as
programmer chooses to treat it like one.
That is why a lot of people uses variable names like lpz to specifically
clarify that _they_ treat the data as a zero-terminated text string, and
not an array of characters or bytes.
One of the main advantages of a language such as C is the opportunities to
make best use of the available tools. On the other hand, that is also one
of the biggest disadvantages with the language - a dummy can blow his/her
foot off without noticing the danger ;)
/Per W
On Wed, 18 May 2005 Mat...@Ve... wrote:
> I didn't call the str functions nonstandard.
> I called your particular use of them nonstandard.
>
> --Matt
>
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...]On Behalf Of Per
> Westermark
> Sent: Wednesday, May 18, 2005 11:11 AM
> To: Guillermo Gutierrez
> Cc: Mat...@Ve...;
> dev...@li...
> Subject: RE: FW: [Dev-C++] Win32 Shell API
>
>
> Calling strxxx() functions non-standard sounds a bit amusing given the
> fact that they are part of a large number of standards and also used in
> multidigit billion lines of code...
>
> Anyway, yes std::string works perfectly well to use.
>
> std::string s;
> std::string separator;
>
> separator.append("\0",1);
>
> s += "file1.txt";
> s += separator;
> s += "file2.txt";
> s += separator;
> ...
>
> const char* psz = s.c_str();
>
> /Per W
> ___________________________________________________________________
> The information contained in this message and any attachment may be
> proprietary, confidential, and privileged or subject to the work
> product doctrine and thus protected from disclosure. If the reader
> of this message is not the intended recipient, or an employee or
> agent responsible for delivering this message to the intended
> recipient, you are hereby notified that any dissemination,
> distribution or copying of this communication is strictly prohibited.
> If you have received this communication in error, please notify me
> immediately by replying to this message and deleting it and all
> copies and backups thereof. Thank you.
>
|
|
From: <Mat...@Ve...> - 2005-05-18 19:18:12
|
I didn't call the str functions nonstandard.
I called your particular use of them nonstandard.
--Matt
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Per
Westermark
Sent: Wednesday, May 18, 2005 11:11 AM
To: Guillermo Gutierrez
Cc: Mat...@Ve...;
dev...@li...
Subject: RE: FW: [Dev-C++] Win32 Shell API
Calling strxxx() functions non-standard sounds a bit amusing given the
fact that they are part of a large number of standards and also used in
multidigit billion lines of code...
Anyway, yes std::string works perfectly well to use.
std::string s;
std::string separator;
separator.append("\0",1);
s += "file1.txt";
s += separator;
s += "file2.txt";
s += separator;
...
const char* psz = s.c_str();
/Per W
___________________________________________________________________
The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure. If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof. Thank you.
|
|
From: Per W. <pw...@ia...> - 2005-05-18 18:11:39
|
Calling strxxx() functions non-standard sounds a bit amusing given the
fact that they are part of a large number of standards and also used in
multidigit billion lines of code...
Anyway, yes std::string works perfectly well to use.
std::string s;
std::string separator;
separator.append("\0",1);
s += "file1.txt";
s += separator;
s += "file2.txt";
s += separator;
...
const char* psz = s.c_str();
/Per W
On Wed, 18 May 2005, Guillermo Gutierrez wrote:
> Yes, that is most likely what I will end up doing next now that I have gotten it to work with the C character arrays.
>
> -----Original Message-----
> From: Mat...@Ve...
> [mailto:Mat...@Ve...]
> Sent: Wednesday, May 18, 2005 9:18 AM
> To: Guillermo Gutierrez
> Subject: RE: FW: [Dev-C++] Win32 Shell API
>
>
> Just use STL strings for each.
> Don't do all this weird nonstandard stuff with C character arrays.
> Then use the c_str() function to pass the data out of the string in C
> format.
>
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...]On Behalf Of Guillermo
> Gutierrez
> Sent: Tuesday, May 17, 2005 4:20 PM
> To: Per Westermark
> Cc: dev...@li...
> Subject: RE: FW: [Dev-C++] Win32 Shell API
>
>
> I am using a char SrcPath[20000] variable to hold the name (yes, the full
> string gets close to being that long.)
>
> I fill the array like this:
>
> //LP4 is a variable that holds the source path + filename (lp4.exe)
> //SFA - (same as above, source path + "mssfa.exe")
>
> strcpy ( SrcPath, LP4 );
> strcat ( SrcPath, "\0");
> strcat ( SrcPath, SFA );
> strcat ( SrcPath, "\0\0" );
> std::cout << "SrcPath: " << SrcPath << endl;
>
> unfortunately the output of "cout << SrcPath" shows both of the paths as one
> that is what is causing the app to think of it as one huge path for a file
> rather than 2 paths/files.
>
> -----Original Message-----
> From: Per Westermark [mailto:pw...@ia...]
> Sent: Tuesday, May 17, 2005 3:56 PM
> To: Guillermo Gutierrez
> Subject: RE: FW: [Dev-C++] Win32 Shell API
>
>
> When not generating the strings, it's almost the same thing to do:
> char *source = "hello world";
> or:
> char source[] = "hello world";
>
> When dyanmically generating the file names, then source is of course
> declared something like:
> char source[2000];
>
> Note that when concatenating multiple file names, you must manually insert
> the '\0' character after the names, since the string functions will break
> at the null character.
>
> By the way - why did you unlink the mailing list?
>
> /Per W
>
> On Tue, 17 May 2005, Guillermo Gutierrez wrote:
>
> > hmm...char *source;
> > do get a different result if you use "char source" vs "char *source"?
> >
> > -----Original Message-----
> > From: Per Westermark [mailto:pw...@ia...]
> > Sent: Tuesday, May 17, 2005 3:31 PM
> > To: Guillermo Gutierrez
> > Subject: RE: FW: [Dev-C++] Win32 Shell API
> >
> >
> > Minimalistic multi-source -> single directory:
> > char *source =
> > "c:/usr/src/test/test_shfileoperation/src/1.txt\0"
> > "c:/usr/src/test/test_shfileoperation/src/2.txt\0"
> > "c:/usr/src/test/test_shfileoperation/src/3.txt\0";
> > char *dst =
> > "c:/usr/src/test/test_shfileoperation/dst\0";
> > SHFILEOPSTRUCT op;
> > memset(&op,0,sizeof(op));
> > op.wFunc = FO_COPY;
> > op.pFrom = source;
> > op.pTo = dst;
> > int res = SHFileOperation(&op);
> >
> > (alas hand-copied from Win machine...)
> >
> > /Per W
> >
> > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> >
> > > I copy to a single destination path.
> > >
> > > -----Original Message-----
> > > From: Per Westermark [mailto:pw...@ia...]
> > > Sent: Tuesday, May 17, 2005 3:08 PM
> > > To: Guillermo Gutierrez
> > > Subject: Re: FW: [Dev-C++] Win32 Shell API
> > >
> > >
> > > Do you copy to a single destination path, or do you specify multiple
> > > destinations, i.e. one destination for every source file?
> > >
> > > /Per W
> > >
> > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > >
> > > > P.S.S
> > > > correction on the error:
> > > > windows tells me that it cannot read the files from the source or
> disk. When I click past the initial error, my custom error handling message
> box reveals that the function failed with an error code of '6'.
> > > > This works correctly if I only try to copy one file.
> > > >
> > > > Also, the last part of the path name is generated from the current
> system date by the program that creates the folder (Borland's Final
> Builder), so I have to do some grunt work to get the correct "full" path.
> > > >
> > > > -----Original Message-----
> > > > From: Guillermo Gutierrez
> > > > Sent: Tuesday, May 17, 2005 2:22 PM
> > > > To: 'pw...@ia...'
> > > > Subject: RE: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > P.S.
> > > > The path string that I am copying to is quite shorter than the string
> that I am copying from.
> > > >
> > > > -----Original Message-----
> > > > From: Guillermo Gutierrez
> > > > Sent: Tuesday, May 17, 2005 2:19 PM
> > > > To: 'Per Westermark'
> > > > Subject: RE: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > I am not able to get the file copy to work because it appears that for
> some reason the "\0" at the end of each path\filename is not being read or
> the path is too long.
> > > >
> > > > The path string I am using to copy from is
> "Q:\\QA\\Builds\\Current\\"2005-5-17\\".
> > > >
> > > > The only thing that changes is the filename that is added at the end
> of the string, I then use the different versions (meaning same string with
> different filename appended) with a null-termination ("\0") at the end to
> create one long string of the 10 files I need to copy. I also make sure to
> add an extra "\0" at the end of the whole string per the documentation (that
> string should be double nul-terminated).
> > > >
> > > > I get a windows error when the copy function is used stating that the
> file could not be found and it displays the string as one huge filename.
> > > >
> > > > -----Original Message-----
> > > > From: Per Westermark [mailto:pw...@ia...]
> > > > Sent: Tuesday, May 17, 2005 12:52 PM
> > > > To: Guillermo Gutierrez
> > > > Subject: RE: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > Ok. Now I tested to copy multiple files with a single call. Did work.
> No
> > > > problem with the examples I found.
> > > >
> > > > Back to my previous question: What is wrong with the available
> examples?
> > > >
> > > > By the way: I started off by googling for
> > > > "copying multiple files with SHFileOperation"
> > > >
> > > > /Per W
> > > >
> > > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > > >
> > > > > I have tried looking on google and have found only the same old
> tired examples of how to delete files using the operation or how to copy a
> file with it and how it "should" work to copy multiple files.
> > > > >
> > > > > I need to copy 10 - 50 files from a rather long path and have not
> been successful using it.
> > > > >
> > > > > Is that enough info for your liking? or if you like you can go into
> your world, ignore my email, and let someone who cares answer back.
> > > > >
> > > > > -----Original Message-----
> > > > > From: Per Westermark [mailto:pw...@ia...]
> > > > > Sent: Tuesday, May 17, 2005 12:16 PM
> > > > > To: Guillermo Gutierrez
> > > > > Cc: dev...@li...
> > > > > Subject: Re: [Dev-C++] Win32 Shell API
> > > > >
> > > > >
> > > > > Can we expect you to repeat this question until somehow someone new
> to
> > > > > this list and takes the time to write something about it? It takes
> quite
> > > > > some time to write the answer you like. You can, on the other hand,
> find
> > > > > that information without too much google magic.
> > > > >
> > > > > This is your - at least - third mail about requests for help with
> shell
> > > > > copy. And while discussing shell copy - you haven't even mentioned
> any
> > > > > special reason for your desperate need for use of this specific
> function,
> > > > > or why the answer must come from this list instead of from google.
> > > > >
> > > > > If the google links contains wrong information, or wrong type of
> > > > > information, just say so and specify exactly what makes your
> requirements
> > > > > completely different from other peoples.
> > > > >
> > > > > /Per W
> > > > >
> > > > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > > > >
> > > > > > Does any one out there have any experience with Windows Shell API?
> > > > > > Particularly with copying files using 'SHFileOperation()' ?
> > > > > >
> > > > > > Guillermo Gutierrez
> > > > > > Market Scan Information Systems
> > > > > > Software Q.A. Supervisor
> > > > > > (818) 575-2000 x2427
> > > > > > ggu...@ma...
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> ___________________________________________________________________
> The information contained in this message and any attachment may be
> proprietary, confidential, and privileged or subject to the work
> product doctrine and thus protected from disclosure. If the reader
> of this message is not the intended recipient, or an employee or
> agent responsible for delivering this message to the intended
> recipient, you are hereby notified that any dissemination,
> distribution or copying of this communication is strictly prohibited.
> If you have received this communication in error, please notify me
> immediately by replying to this message and deleting it and all
> copies and backups the
|
|
From: Daniel P. <dan...@st...> - 2005-05-18 17:45:55
|
i would suggest the easiest way to find where it goes wrong add printouts at every major point (checking pointers, values and so on) /Daniel pettersson Reid Thompson wrote: >Patel, Nilesh M wrote: > > >>the project has about 10files. and pin pointing the problem >>looking at the code might be difficult. >>when i compile and run my code in Linux terminal everything >>works fine. when I run my code in Mac terminal I get a clean >>compile. but when I run the project I'm encountered with the >>segmentation fault. >> >>I am doing some research online and thought it was because of >>me choosing a wrong serial path or wrong c flags, but not >>sure at the moment. Thanks for your input. >> >> > >using a debugger would prob provide more specific pointers on what to >google for or even point directly to the cause > >reid > > >------------------------------------------------------- >This SF.Net email is sponsored by Oracle Space Sweepstakes >Want to be the first software developer in space? >Enter now for the Oracle Space Sweepstakes! >http://ads.osdn.com/?ad_idt12&alloc_id344&op=click >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > |
|
From: Guillermo G. <ggu...@ma...> - 2005-05-18 16:21:08
|
Yes, that is most likely what I will end up doing next now that I have =
gotten it to work with the C character arrays.
-----Original Message-----
From: Mat...@Ve...
[mailto:Mat...@Ve...]
Sent: Wednesday, May 18, 2005 9:18 AM
To: Guillermo Gutierrez
Subject: RE: FW: [Dev-C++] Win32 Shell API
Just use STL strings for each.
Don't do all this weird nonstandard stuff with C character arrays.
Then use the c_str() function to pass the data out of the string in C
format.
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Guillermo
Gutierrez
Sent: Tuesday, May 17, 2005 4:20 PM
To: Per Westermark
Cc: dev...@li...
Subject: RE: FW: [Dev-C++] Win32 Shell API
I am using a char SrcPath[20000] variable to hold the name (yes, the =
full
string gets close to being that long.)
I fill the array like this:
//LP4 is a variable that holds the source path + filename (lp4.exe)
//SFA - (same as above, source path + "mssfa.exe")
strcpy ( SrcPath, LP4 );
strcat ( SrcPath, "\0");
strcat ( SrcPath, SFA );
strcat ( SrcPath, "\0\0" );
std::cout << "SrcPath: " << SrcPath << endl;
unfortunately the output of "cout << SrcPath" shows both of the paths as =
one
that is what is causing the app to think of it as one huge path for a =
file
rather than 2 paths/files.
-----Original Message-----
From: Per Westermark [mailto:pw...@ia...]
Sent: Tuesday, May 17, 2005 3:56 PM
To: Guillermo Gutierrez
Subject: RE: FW: [Dev-C++] Win32 Shell API
When not generating the strings, it's almost the same thing to do:
char *source =3D "hello world";
or:
char source[] =3D "hello world";
When dyanmically generating the file names, then source is of course
declared something like:
char source[2000];
Note that when concatenating multiple file names, you must manually =
insert
the '\0' character after the names, since the string functions will =
break
at the null character.
By the way - why did you unlink the mailing list?
/Per W
On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> hmm...char *source;
> do get a different result if you use "char source" vs "char *source"?
>
> -----Original Message-----
> From: Per Westermark [mailto:pw...@ia...]
> Sent: Tuesday, May 17, 2005 3:31 PM
> To: Guillermo Gutierrez
> Subject: RE: FW: [Dev-C++] Win32 Shell API
>
>
> Minimalistic multi-source -> single directory:
> char *source =3D
> "c:/usr/src/test/test_shfileoperation/src/1.txt\0"
> "c:/usr/src/test/test_shfileoperation/src/2.txt\0"
> "c:/usr/src/test/test_shfileoperation/src/3.txt\0";
> char *dst =3D
> "c:/usr/src/test/test_shfileoperation/dst\0";
> SHFILEOPSTRUCT op;
> memset(&op,0,sizeof(op));
> op.wFunc =3D FO_COPY;
> op.pFrom =3D source;
> op.pTo =3D dst;
> int res =3D SHFileOperation(&op);
>
> (alas hand-copied from Win machine...)
>
> /Per W
>
> On Tue, 17 May 2005, Guillermo Gutierrez wrote:
>
> > I copy to a single destination path.
> >
> > -----Original Message-----
> > From: Per Westermark [mailto:pw...@ia...]
> > Sent: Tuesday, May 17, 2005 3:08 PM
> > To: Guillermo Gutierrez
> > Subject: Re: FW: [Dev-C++] Win32 Shell API
> >
> >
> > Do you copy to a single destination path, or do you specify multiple
> > destinations, i.e. one destination for every source file?
> >
> > /Per W
> >
> > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> >
> > > P.S.S
> > > correction on the error:
> > > windows tells me that it cannot read the files from the source or
disk. When I click past the initial error, my custom error handling =
message
box reveals that the function failed with an error code of '6'.
> > > This works correctly if I only try to copy one file.
> > >
> > > Also, the last part of the path name is generated from the current
system date by the program that creates the folder (Borland's Final
Builder), so I have to do some grunt work to get the correct "full" =
path.
> > >
> > > -----Original Message-----
> > > From: Guillermo Gutierrez
> > > Sent: Tuesday, May 17, 2005 2:22 PM
> > > To: 'pw...@ia...'
> > > Subject: RE: [Dev-C++] Win32 Shell API
> > >
> > >
> > > P.S.
> > > The path string that I am copying to is quite shorter than the =
string
that I am copying from.
> > >
> > > -----Original Message-----
> > > From: Guillermo Gutierrez
> > > Sent: Tuesday, May 17, 2005 2:19 PM
> > > To: 'Per Westermark'
> > > Subject: RE: [Dev-C++] Win32 Shell API
> > >
> > >
> > > I am not able to get the file copy to work because it appears that =
for
some reason the "\0" at the end of each path\filename is not being read =
or
the path is too long.
> > >
> > > The path string I am using to copy from is
"Q:\\QA\\Builds\\Current\\"2005-5-17\\".
> > >
> > > The only thing that changes is the filename that is added at the =
end
of the string, I then use the different versions (meaning same string =
with
different filename appended) with a null-termination ("\0") at the end =
to
create one long string of the 10 files I need to copy. I also make sure =
to
add an extra "\0" at the end of the whole string per the documentation =
(that
string should be double nul-terminated).
> > >
> > > I get a windows error when the copy function is used stating that =
the
file could not be found and it displays the string as one huge filename.
> > >
> > > -----Original Message-----
> > > From: Per Westermark [mailto:pw...@ia...]
> > > Sent: Tuesday, May 17, 2005 12:52 PM
> > > To: Guillermo Gutierrez
> > > Subject: RE: [Dev-C++] Win32 Shell API
> > >
> > >
> > > Ok. Now I tested to copy multiple files with a single call. Did =
work.
No
> > > problem with the examples I found.
> > >
> > > Back to my previous question: What is wrong with the available
examples?
> > >
> > > By the way: I started off by googling for
> > > "copying multiple files with SHFileOperation"
> > >
> > > /Per W
> > >
> > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > >
> > > > I have tried looking on google and have found only the same old
tired examples of how to delete files using the operation or how to copy =
a
file with it and how it "should" work to copy multiple files.
> > > >
> > > > I need to copy 10 - 50 files from a rather long path and have =
not
been successful using it.
> > > >
> > > > Is that enough info for your liking? or if you like you can go =
into
your world, ignore my email, and let someone who cares answer back.
> > > >
> > > > -----Original Message-----
> > > > From: Per Westermark [mailto:pw...@ia...]
> > > > Sent: Tuesday, May 17, 2005 12:16 PM
> > > > To: Guillermo Gutierrez
> > > > Cc: dev...@li...
> > > > Subject: Re: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > Can we expect you to repeat this question until somehow someone =
new
to
> > > > this list and takes the time to write something about it? It =
takes
quite
> > > > some time to write the answer you like. You can, on the other =
hand,
find
> > > > that information without too much google magic.
> > > >
> > > > This is your - at least - third mail about requests for help =
with
shell
> > > > copy. And while discussing shell copy - you haven't even =
mentioned
any
> > > > special reason for your desperate need for use of this specific
function,
> > > > or why the answer must come from this list instead of from =
google.
> > > >
> > > > If the google links contains wrong information, or wrong type of
> > > > information, just say so and specify exactly what makes your
requirements
> > > > completely different from other peoples.
> > > >
> > > > /Per W
> > > >
> > > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > > >
> > > > > Does any one out there have any experience with Windows Shell =
API?
> > > > > Particularly with copying files using 'SHFileOperation()' ?
> > > > >
> > > > > Guillermo Gutierrez
> > > > > Market Scan Information Systems
> > > > > Software Q.A. Supervisor
> > > > > (818) 575-2000 x2427
> > > > > ggu...@ma...
> > > > >
> > > > >
> > > >
> > >
> >
>
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id=16344&op=3Dclick
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
___________________________________________________________________
The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure. If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof. Thank you.
|
|
From: Reid T. <Rei...@at...> - 2005-05-18 15:50:25
|
Patel, Nilesh M wrote: > the project has about 10files. and pin pointing the problem > looking at the code might be difficult. > when i compile and run my code in Linux terminal everything > works fine. when I run my code in Mac terminal I get a clean > compile. but when I run the project I'm encountered with the > segmentation fault.=20 >=20 > I am doing some research online and thought it was because of > me choosing a wrong serial path or wrong c flags, but not > sure at the moment. Thanks for your input. using a debugger would prob provide more specific pointers on what to google for or even point directly to the cause reid |
|
From: Reid T. <Rei...@at...> - 2005-05-18 15:30:16
|
Patel, Nilesh M wrote: > I have written a project in C++ and I am using a terminal to > compile my code. When I compile my project using g++ > (allFiles.cpp allFiles.h) -o ABC, NO bugs. When I try to run > the project, I keep encountering this problem. "Segmentation > fault" =3D =3D > I have no idea what this is? Does anyone know? > Can anyone shed some light on this matter? What I am doing > wrong? Do you think my serial path might be wrong? >=20 > I have to run my project like so: ./ABC something /dev/ttyS0 >=20 > ttyS0 or ttyS1 are desired serial paths. >=20 > Thanks. >=20 a successful compile !=3D no bugs -- you have a bug in your code that is causing the application to crash. w/o seeing the code, the only suggestion I can make is to run the app in a debugger reid |
|
From: Per W. <pw...@ia...> - 2005-05-18 15:27:09
|
Compilation without any errors means syntactically correct code, i.e. have nothing to do with bugs. Some potential bugs are detectable by the compiler and might result in warnings. However, bugs are logical errors resulting in failed execution of a program, or incorrect results being produced. In this case, you have any kind of memory reference error in the code. /Per W On Wed, 18 May 2005, Patel, Nilesh M wrote: > I have written a project in C++ and I am using a terminal to compile my code. When I compile my project using g++ (allFiles.cpp allFiles.h) -o ABC, NO bugs. When I try to run the project, I keep encountering this problem. "Segmentation fault" = = > I have no idea what this is? Does anyone know? Can anyone shed some light on this matter? What I am doing wrong? Do you think my serial path might be wrong? > > I have to run my project like so: ./ABC something /dev/ttyS0 > > ttyS0 or ttyS1 are desired serial paths. > > Thanks. |
|
From: Guillermo G. <ggu...@ma...> - 2005-05-18 15:26:12
|
yes you are correct, everything works perfect now. I also have a much = better understanding of strings and "\0" as well as the string = manipulation functions. thank you soooooooooooooooo much for your help. P.S. sorry, didn't mean to not include the list. The whole "Reply" vs. = "Reply to All" thing is something I still can't get used to. I am = spoiled by other mailing lists that send to the list's address when you = hit reply instead of the individual's email address. -----Original Message----- From: Per Westermark [mailto:pw...@ia...] Sent: Tuesday, May 17, 2005 9:13 PM To: Guillermo Gutierrez Subject: RE: FW: [Dev-C++] Win32 Shell API Once more: strlen() or any other strxxx() function can NOT be used when processing strings containing \0 in the middle. It is impossible to do strlen(SrcPath) and get more than the length of = the FIRST file name inserted into the array! The '\0' separator between the file names will stop strlen() early! Normal printout functions can NOT display the contents of the following file names, even if they are correctly stored in the array. Even if SrcPath is non-printable, this code DO work! char SrcPath[1000],*p; p =3D SrcPath; strcpy(p,"c:/src/1.txt"); p +=3D strlen(p)+1; // Step past first file name + one '\0' strcpy(p,"c:/src/2.txt"); p +=3D strlen(p)+1; // Step past second file name + one '\0' strcpy(p,"c:/src/3.txt"); p +=3D strlen(p)+1; // Step past third file name + one '\0' strcpy(p,""); // Insert an extra '\0' as empty filename ... op.pFrom =3D SrcPath; If you build file names in two steps, the above code could instead look like: p =3D SrcPath; strcpy(p,"c:/src/"); // Add path strcat(p,"1.txt"); // Add name part p +=3D strlen(p)+1; // Step past fully qualified file name and '\0' strcpy(p,"c:/src/"); strcat(p,"2.txt"); p +=3D strlen(p)+1; strcpy(p,"c:/src/"); strcat(p,"3.txt"); p +=3D strlen(p)+1; strcpy(p,""); ... op.pFrom =3D SrcPath; or you can even write: p =3D SrcPath; sprintf(p,"c:/src/%d.txt",1); p +=3D strlen(p)+1; sprintf(p,"c:/src/%d.txt",2); p +=3D strlen(p)+1; sprintf(p,"c:/src/%d.txt",3); p +=3D strlen(p)+1; strcpy(p,""); As you can see, any number of different methods may be used to create = the source array. It's just a question of understanding how it works. The important part - that I haven't bothered to discuss - is of course = to keep track of the total size consumed of SrcPath, to make sure you don't get a buffer overflow. The above constructs consumes 1+(p-SrcPath) characters. Once more. Do = NOT think strlen(SrcPath) will help you! To avoid buffer overflows, strncpy, strnprintf or strlen of the individual file names might be used while constantly keeping track of remaining space in the buffer to make sure bad things don't happen! By the way - now we are off the mailing list again! /Per W On Tue, 17 May 2005, Guillermo Gutierrez wrote: > forget the error 6, that was an error in some other area. for some = reason only the first string (LP4) is being placed into SrcPath/SrcPtr = so only one file is being copied. > > -----Original Message----- > From: Guillermo Gutierrez > Sent: Tuesday, May 17, 2005 5:32 PM > To: 'Per Westermark' > Subject: RE: FW: [Dev-C++] Win32 Shell API > > > I am still receiving the error code 6 from windows. I tried changing = the code that sets the source path to: > > char SrcPath[20000]; > char* SrcPtr =3D SrcPath; > > strcpy ( SrcPtr, LP4 ); > SrcPtr +=3D strlen( SrcPtr ) + 1; > strcpy ( SrcPtr, SFA ); > SrcPtr +=3D strlen( SrcPtr ) + 1; > strcpy ( SrcPtr, "" ); > > and the error still happens. I suspect that maybe "strlen ( SrcPtr ) + = 1" could/should be "strlen ( SrcPath) + 1"? > > > -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Tuesday, May 17, 2005 4:30 PM > To: Guillermo Gutierrez > Cc: dev...@li... > Subject: RE: FW: [Dev-C++] Win32 Shell API > > > That is your problem. > > You simply can not use strcat to concatenate a "\0" since it breaks at = the > \0 in the string. > > p =3D SrcPath; > strcpy(p,LP4); > p +=3D strlen(p)+1; // skip # of inserted chars + the '\0'; > strcpy(p,SFA); > p +=3D strlen(p)+1; // "- > strcpy(p,""); // just writes the final '\0' > > And of course, you can not use std::cout to emit a char* or char[] = that > contains '\0' in the middle... > > /Per W > > On Tue, 17 May 2005, Guillermo Gutierrez wrote: > > > I am using a char SrcPath[20000] variable to hold the name (yes, the = full string gets close to being that long.) > > > > I fill the array like this: > > > > //LP4 is a variable that holds the source path + filename (lp4.exe) > > //SFA - (same as above, source path + "mssfa.exe") > > > > strcpy ( SrcPath, LP4 ); > > strcat ( SrcPath, "\0"); > > strcat ( SrcPath, SFA ); > > strcat ( SrcPath, "\0\0" ); > > std::cout << "SrcPath: " << SrcPath << endl; > > > > unfortunately the output of "cout << SrcPath" shows both of the = paths as one that is what is causing the app to think of it as one huge = path for a file rather than 2 paths/files. |
|
From: Patel, N. M <Nil...@qu...> - 2005-05-18 14:45:54
|
I have written a project in C++ and I am using a terminal to compile my = code. When I compile my project using g++ (allFiles.cpp allFiles.h) -o ABC,= = NO bugs. When I try to run the project, I keep encountering this problem. = "Segmentation fault" =3D =3D > I have no idea what this is=3F Does anyone = know=3F Can anyone shed some light on this matter=3F What I am doing = wrong=3F Do you think my serial path might be wrong=3F I have to run my project like so: ./ABC something /dev/ttyS0 ttyS0 or ttyS1 are desired serial paths. Thanks. -----Original Message----- =46rom: dev...@li... [mailto:dev...@li...]On Behalf Of dev...@li... Sent: Tuesday, May 17, 2005 11:14 PM To: dev...@li... Subject: Dev-cpp-users digest, Vol 1 #2422 - 5 msgs Send Dev-cpp-users mailing list submissions to dev...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/dev-cpp-users or, via email, send a message with subject or body 'help' to dev...@li... You can reach the person managing the list at dev...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Dev-cpp-users digest..." --__--__-- _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users End of Dev-cpp-users Digest =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D The contents of this message, together with any attachments, are intended = only for the use of the person(s) to which they are addressed and may = contain confidential and/or privileged information. Further, any medical = information herein is confidential and protected by law. It is unlawful for= = unauthorized persons to use, review, copy, disclose, or disseminate = confidential medical information. If you are not the intended recipient, = immediately advise the sender and delete this message and any attachments. = Any distribution, or copying of this message, or any attachment, is = prohibited. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D |
|
From: Per W. <pw...@ia...> - 2005-05-17 23:51:29
|
Sorry, anything working on zero-terminated strings would fail. Only code working on length-specified strings can work. And you can't just convert from char* to a std::string since that convertion knows that the c string is zero-terminated and ends early. But why do you want to print the string? Easiest to print it is to loop through the sub-strings until the \0\0 is found, but when the string is correct, there is no need to print it - just use it for the file copy. /Per W On Tue, 17 May 2005, Guillermo Gutierrez wrote: > ah of course...I was beginning to suspect as much. > > [...] > > And of course, you can not use std::cout to emit a char* or char[] that > > contains '\0' in the middle... > [...] > > would printf() be ok to emit that char*/char[] with? |
|
From: Guillermo G. <ggu...@ma...> - 2005-05-17 23:45:09
|
ah of course...I was beginning to suspect as much. [...] > And of course, you can not use std::cout to emit a char* or char[] = that > contains '\0' in the middle... [...] would printf() be ok to emit that char*/char[] with? -----Original Message----- From: Per Westermark [mailto:pw...@ia...] Sent: Tuesday, May 17, 2005 4:42 PM To: Guillermo Gutierrez Cc: dev...@li... Subject: RE: FW: [Dev-C++] Win32 Shell API p would have to be char* since it must be changed to point at different locations. char p[] is a fixed array that can't be moved. /Per W On Tue, 17 May 2005, Guillermo Gutierrez wrote: > 'p' would be a char* then? or a char p[]? > > -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Tuesday, May 17, 2005 4:30 PM > To: Guillermo Gutierrez > Cc: dev...@li... > Subject: RE: FW: [Dev-C++] Win32 Shell API > > > That is your problem. > > You simply can not use strcat to concatenate a "\0" since it breaks at = the > \0 in the string. > > p =3D SrcPath; > strcpy(p,LP4); > p +=3D strlen(p)+1; // skip # of inserted chars + the '\0'; > strcpy(p,SFA); > p +=3D strlen(p)+1; // "- > strcpy(p,""); // just writes the final '\0' > > And of course, you can not use std::cout to emit a char* or char[] = that > contains '\0' in the middle... > > /Per W |
|
From: Per W. <pw...@ia...> - 2005-05-17 23:41:56
|
p would have to be char* since it must be changed to point at different locations. char p[] is a fixed array that can't be moved. /Per W On Tue, 17 May 2005, Guillermo Gutierrez wrote: > 'p' would be a char* then? or a char p[]? > > -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Tuesday, May 17, 2005 4:30 PM > To: Guillermo Gutierrez > Cc: dev...@li... > Subject: RE: FW: [Dev-C++] Win32 Shell API > > > That is your problem. > > You simply can not use strcat to concatenate a "\0" since it breaks at the > \0 in the string. > > p = SrcPath; > strcpy(p,LP4); > p += strlen(p)+1; // skip # of inserted chars + the '\0'; > strcpy(p,SFA); > p += strlen(p)+1; // "- > strcpy(p,""); // just writes the final '\0' > > And of course, you can not use std::cout to emit a char* or char[] that > contains '\0' in the middle... > > /Per W |
|
From: Guillermo G. <ggu...@ma...> - 2005-05-17 23:39:44
|
'p' would be a char* then? or a char p[]?
-----Original Message-----
From: Per Westermark [mailto:pw...@ia...]
Sent: Tuesday, May 17, 2005 4:30 PM
To: Guillermo Gutierrez
Cc: dev...@li...
Subject: RE: FW: [Dev-C++] Win32 Shell API
That is your problem.
You simply can not use strcat to concatenate a "\0" since it breaks at =
the
\0 in the string.
p =3D SrcPath;
strcpy(p,LP4);
p +=3D strlen(p)+1; // skip # of inserted chars + the '\0';
strcpy(p,SFA);
p +=3D strlen(p)+1; // "-
strcpy(p,""); // just writes the final '\0'
And of course, you can not use std::cout to emit a char* or char[] that
contains '\0' in the middle...
/Per W
On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> I am using a char SrcPath[20000] variable to hold the name (yes, the =
full string gets close to being that long.)
>
> I fill the array like this:
>
> //LP4 is a variable that holds the source path + filename (lp4.exe)
> //SFA - (same as above, source path + "mssfa.exe")
>
> strcpy ( SrcPath, LP4 );
> strcat ( SrcPath, "\0");
> strcat ( SrcPath, SFA );
> strcat ( SrcPath, "\0\0" );
> std::cout << "SrcPath: " << SrcPath << endl;
>
> unfortunately the output of "cout << SrcPath" shows both of the paths =
as one that is what is causing the app to think of it as one huge path =
for a file rather than 2 paths/files.
>
> -----Original Message-----
> From: Per Westermark [mailto:pw...@ia...]
> Sent: Tuesday, May 17, 2005 3:56 PM
> To: Guillermo Gutierrez
> Subject: RE: FW: [Dev-C++] Win32 Shell API
>
>
> When not generating the strings, it's almost the same thing to do:
> char *source =3D "hello world";
> or:
> char source[] =3D "hello world";
>
> When dyanmically generating the file names, then source is of course
> declared something like:
> char source[2000];
>
> Note that when concatenating multiple file names, you must manually =
insert
> the '\0' character after the names, since the string functions will =
break
> at the null character.
>
> By the way - why did you unlink the mailing list?
>
> /Per W
>
> On Tue, 17 May 2005, Guillermo Gutierrez wrote:
>
> > hmm...char *source;
> > do get a different result if you use "char source" vs "char =
*source"?
> >
> > -----Original Message-----
> > From: Per Westermark [mailto:pw...@ia...]
> > Sent: Tuesday, May 17, 2005 3:31 PM
> > To: Guillermo Gutierrez
> > Subject: RE: FW: [Dev-C++] Win32 Shell API
> >
> >
> > Minimalistic multi-source -> single directory:
> > char *source =3D
> > "c:/usr/src/test/test_shfileoperation/src/1.txt\0"
> > "c:/usr/src/test/test_shfileoperation/src/2.txt\0"
> > "c:/usr/src/test/test_shfileoperation/src/3.txt\0";
> > char *dst =3D
> > "c:/usr/src/test/test_shfileoperation/dst\0";
> > SHFILEOPSTRUCT op;
> > memset(&op,0,sizeof(op));
> > op.wFunc =3D FO_COPY;
> > op.pFrom =3D source;
> > op.pTo =3D dst;
> > int res =3D SHFileOperation(&op);
> >
> > (alas hand-copied from Win machine...)
> >
> > /Per W
> >
> > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> >
> > > I copy to a single destination path.
> > >
> > > -----Original Message-----
> > > From: Per Westermark [mailto:pw...@ia...]
> > > Sent: Tuesday, May 17, 2005 3:08 PM
> > > To: Guillermo Gutierrez
> > > Subject: Re: FW: [Dev-C++] Win32 Shell API
> > >
> > >
> > > Do you copy to a single destination path, or do you specify =
multiple
> > > destinations, i.e. one destination for every source file?
> > >
> > > /Per W
> > >
> > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > >
> > > > P.S.S
> > > > correction on the error:
> > > > windows tells me that it cannot read the files from the source =
or disk. When I click past the initial error, my custom error handling =
message box reveals that the function failed with an error code of '6'.
> > > > This works correctly if I only try to copy one file.
> > > >
> > > > Also, the last part of the path name is generated from the =
current system date by the program that creates the folder (Borland's =
Final Builder), so I have to do some grunt work to get the correct =
"full" path.
> > > >
> > > > -----Original Message-----
> > > > From: Guillermo Gutierrez
> > > > Sent: Tuesday, May 17, 2005 2:22 PM
> > > > To: 'pw...@ia...'
> > > > Subject: RE: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > P.S.
> > > > The path string that I am copying to is quite shorter than the =
string that I am copying from.
> > > >
> > > > -----Original Message-----
> > > > From: Guillermo Gutierrez
> > > > Sent: Tuesday, May 17, 2005 2:19 PM
> > > > To: 'Per Westermark'
> > > > Subject: RE: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > I am not able to get the file copy to work because it appears =
that for some reason the "\0" at the end of each path\filename is not =
being read or the path is too long.
> > > >
> > > > The path string I am using to copy from is =
"Q:\\QA\\Builds\\Current\\"2005-5-17\\".
> > > >
> > > > The only thing that changes is the filename that is added at the =
end of the string, I then use the different versions (meaning same =
string with different filename appended) with a null-termination ("\0") =
at the end to create one long string of the 10 files I need to copy. I =
also make sure to add an extra "\0" at the end of the whole string per =
the documentation (that string should be double nul-terminated).
> > > >
> > > > I get a windows error when the copy function is used stating =
that the file could not be found and it displays the string as one huge =
filename.
> > > >
> > > > -----Original Message-----
> > > > From: Per Westermark [mailto:pw...@ia...]
> > > > Sent: Tuesday, May 17, 2005 12:52 PM
> > > > To: Guillermo Gutierrez
> > > > Subject: RE: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > Ok. Now I tested to copy multiple files with a single call. Did =
work. No
> > > > problem with the examples I found.
> > > >
> > > > Back to my previous question: What is wrong with the available =
examples?
> > > >
> > > > By the way: I started off by googling for
> > > > "copying multiple files with SHFileOperation"
> > > >
> > > > /Per W
> > > >
> > > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > > >
> > > > > I have tried looking on google and have found only the same =
old tired examples of how to delete files using the operation or how to =
copy a file with it and how it "should" work to copy multiple files.
> > > > >
> > > > > I need to copy 10 - 50 files from a rather long path and have =
not been successful using it.
> > > > >
> > > > > Is that enough info for your liking? or if you like you can go =
into your world, ignore my email, and let someone who cares answer back.
> > > > >
> > > > > -----Original Message-----
> > > > > From: Per Westermark [mailto:pw...@ia...]
> > > > > Sent: Tuesday, May 17, 2005 12:16 PM
> > > > > To: Guillermo Gutierrez
> > > > > Cc: dev...@li...
> > > > > Subject: Re: [Dev-C++] Win32 Shell API
> > > > >
> > > > >
> > > > > Can we expect you to repeat this question until somehow =
someone new to
> > > > > this list and takes the time to write something about it? It =
takes quite
> > > > > some time to write the answer you like. You can, on the other =
hand, find
> > > > > that information without too much google magic.
> > > > >
> > > > > This is your - at least - third mail about requests for help =
with shell
> > > > > copy. And while discussing shell copy - you haven't even =
mentioned any
> > > > > special reason for your desperate need for use of this =
specific function,
> > > > > or why the answer must come from this list instead of from =
google.
> > > > >
> > > > > If the google links contains wrong information, or wrong type =
of
> > > > > information, just say so and specify exactly what makes your =
requirements
> > > > > completely different from other peoples.
> > > > >
> > > > > /Per W
> > > > >
> > > > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > > > >
> > > > > > Does any one out there have any experience with Windows =
Shell API?
> > > > > > Particularly with copying files using 'SHFileOperation()' ?
> > > > > >
> > > > > > Guillermo Gutierrez
> > > > > > Market Scan Information Systems
> > > > > > Software Q.A. Supervisor
> > > > > > (818) 575-2000 x2427
> > > > > > ggu...@ma...
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
>
|
|
From: Per W. <pw...@ia...> - 2005-05-17 23:30:34
|
That is your problem.
You simply can not use strcat to concatenate a "\0" since it breaks at the
\0 in the string.
p = SrcPath;
strcpy(p,LP4);
p += strlen(p)+1; // skip # of inserted chars + the '\0';
strcpy(p,SFA);
p += strlen(p)+1; // "-
strcpy(p,""); // just writes the final '\0'
And of course, you can not use std::cout to emit a char* or char[] that
contains '\0' in the middle...
/Per W
On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> I am using a char SrcPath[20000] variable to hold the name (yes, the full string gets close to being that long.)
>
> I fill the array like this:
>
> //LP4 is a variable that holds the source path + filename (lp4.exe)
> //SFA - (same as above, source path + "mssfa.exe")
>
> strcpy ( SrcPath, LP4 );
> strcat ( SrcPath, "\0");
> strcat ( SrcPath, SFA );
> strcat ( SrcPath, "\0\0" );
> std::cout << "SrcPath: " << SrcPath << endl;
>
> unfortunately the output of "cout << SrcPath" shows both of the paths as one that is what is causing the app to think of it as one huge path for a file rather than 2 paths/files.
>
> -----Original Message-----
> From: Per Westermark [mailto:pw...@ia...]
> Sent: Tuesday, May 17, 2005 3:56 PM
> To: Guillermo Gutierrez
> Subject: RE: FW: [Dev-C++] Win32 Shell API
>
>
> When not generating the strings, it's almost the same thing to do:
> char *source = "hello world";
> or:
> char source[] = "hello world";
>
> When dyanmically generating the file names, then source is of course
> declared something like:
> char source[2000];
>
> Note that when concatenating multiple file names, you must manually insert
> the '\0' character after the names, since the string functions will break
> at the null character.
>
> By the way - why did you unlink the mailing list?
>
> /Per W
>
> On Tue, 17 May 2005, Guillermo Gutierrez wrote:
>
> > hmm...char *source;
> > do get a different result if you use "char source" vs "char *source"?
> >
> > -----Original Message-----
> > From: Per Westermark [mailto:pw...@ia...]
> > Sent: Tuesday, May 17, 2005 3:31 PM
> > To: Guillermo Gutierrez
> > Subject: RE: FW: [Dev-C++] Win32 Shell API
> >
> >
> > Minimalistic multi-source -> single directory:
> > char *source =
> > "c:/usr/src/test/test_shfileoperation/src/1.txt\0"
> > "c:/usr/src/test/test_shfileoperation/src/2.txt\0"
> > "c:/usr/src/test/test_shfileoperation/src/3.txt\0";
> > char *dst =
> > "c:/usr/src/test/test_shfileoperation/dst\0";
> > SHFILEOPSTRUCT op;
> > memset(&op,0,sizeof(op));
> > op.wFunc = FO_COPY;
> > op.pFrom = source;
> > op.pTo = dst;
> > int res = SHFileOperation(&op);
> >
> > (alas hand-copied from Win machine...)
> >
> > /Per W
> >
> > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> >
> > > I copy to a single destination path.
> > >
> > > -----Original Message-----
> > > From: Per Westermark [mailto:pw...@ia...]
> > > Sent: Tuesday, May 17, 2005 3:08 PM
> > > To: Guillermo Gutierrez
> > > Subject: Re: FW: [Dev-C++] Win32 Shell API
> > >
> > >
> > > Do you copy to a single destination path, or do you specify multiple
> > > destinations, i.e. one destination for every source file?
> > >
> > > /Per W
> > >
> > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > >
> > > > P.S.S
> > > > correction on the error:
> > > > windows tells me that it cannot read the files from the source or disk. When I click past the initial error, my custom error handling message box reveals that the function failed with an error code of '6'.
> > > > This works correctly if I only try to copy one file.
> > > >
> > > > Also, the last part of the path name is generated from the current system date by the program that creates the folder (Borland's Final Builder), so I have to do some grunt work to get the correct "full" path.
> > > >
> > > > -----Original Message-----
> > > > From: Guillermo Gutierrez
> > > > Sent: Tuesday, May 17, 2005 2:22 PM
> > > > To: 'pw...@ia...'
> > > > Subject: RE: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > P.S.
> > > > The path string that I am copying to is quite shorter than the string that I am copying from.
> > > >
> > > > -----Original Message-----
> > > > From: Guillermo Gutierrez
> > > > Sent: Tuesday, May 17, 2005 2:19 PM
> > > > To: 'Per Westermark'
> > > > Subject: RE: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > I am not able to get the file copy to work because it appears that for some reason the "\0" at the end of each path\filename is not being read or the path is too long.
> > > >
> > > > The path string I am using to copy from is "Q:\\QA\\Builds\\Current\\"2005-5-17\\".
> > > >
> > > > The only thing that changes is the filename that is added at the end of the string, I then use the different versions (meaning same string with different filename appended) with a null-termination ("\0") at the end to create one long string of the 10 files I need to copy. I also make sure to add an extra "\0" at the end of the whole string per the documentation (that string should be double nul-terminated).
> > > >
> > > > I get a windows error when the copy function is used stating that the file could not be found and it displays the string as one huge filename.
> > > >
> > > > -----Original Message-----
> > > > From: Per Westermark [mailto:pw...@ia...]
> > > > Sent: Tuesday, May 17, 2005 12:52 PM
> > > > To: Guillermo Gutierrez
> > > > Subject: RE: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > Ok. Now I tested to copy multiple files with a single call. Did work. No
> > > > problem with the examples I found.
> > > >
> > > > Back to my previous question: What is wrong with the available examples?
> > > >
> > > > By the way: I started off by googling for
> > > > "copying multiple files with SHFileOperation"
> > > >
> > > > /Per W
> > > >
> > > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > > >
> > > > > I have tried looking on google and have found only the same old tired examples of how to delete files using the operation or how to copy a file with it and how it "should" work to copy multiple files.
> > > > >
> > > > > I need to copy 10 - 50 files from a rather long path and have not been successful using it.
> > > > >
> > > > > Is that enough info for your liking? or if you like you can go into your world, ignore my email, and let someone who cares answer back.
> > > > >
> > > > > -----Original Message-----
> > > > > From: Per Westermark [mailto:pw...@ia...]
> > > > > Sent: Tuesday, May 17, 2005 12:16 PM
> > > > > To: Guillermo Gutierrez
> > > > > Cc: dev...@li...
> > > > > Subject: Re: [Dev-C++] Win32 Shell API
> > > > >
> > > > >
> > > > > Can we expect you to repeat this question until somehow someone new to
> > > > > this list and takes the time to write something about it? It takes quite
> > > > > some time to write the answer you like. You can, on the other hand, find
> > > > > that information without too much google magic.
> > > > >
> > > > > This is your - at least - third mail about requests for help with shell
> > > > > copy. And while discussing shell copy - you haven't even mentioned any
> > > > > special reason for your desperate need for use of this specific function,
> > > > > or why the answer must come from this list instead of from google.
> > > > >
> > > > > If the google links contains wrong information, or wrong type of
> > > > > information, just say so and specify exactly what makes your requirements
> > > > > completely different from other peoples.
> > > > >
> > > > > /Per W
> > > > >
> > > > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > > > >
> > > > > > Does any one out there have any experience with Windows Shell API?
> > > > > > Particularly with copying files using 'SHFileOperation()' ?
> > > > > >
> > > > > > Guillermo Gutierrez
> > > > > > Market Scan Information Systems
> > > > > > Software Q.A. Supervisor
> > > > > > (818) 575-2000 x2427
> > > > > > ggu...@ma...
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
>
|
|
From: Guillermo G. <ggu...@ma...> - 2005-05-17 23:29:40
|
P.S. Didn't mean to unlink the mailing list=20
I keep forgetting that just clicking respond fills in the individual's =
email address instead of the mailing list's address.=20
The fltk mailing list doesn't do this though, hmmm...curious.
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Guillermo
Gutierrez
Sent: Tuesday, May 17, 2005 4:20 PM
To: Per Westermark
Cc: dev...@li...
Subject: RE: FW: [Dev-C++] Win32 Shell API
I am using a char SrcPath[20000] variable to hold the name (yes, the =
full string gets close to being that long.)
I fill the array like this:
//LP4 is a variable that holds the source path + filename (lp4.exe)
//SFA - (same as above, source path + "mssfa.exe")
strcpy ( SrcPath, LP4 );
strcat ( SrcPath, "\0");
strcat ( SrcPath, SFA );
strcat ( SrcPath, "\0\0" );
std::cout << "SrcPath: " << SrcPath << endl;
unfortunately the output of "cout << SrcPath" shows both of the paths as =
one that is what is causing the app to think of it as one huge path for =
a file rather than 2 paths/files.
-----Original Message-----
From: Per Westermark [mailto:pw...@ia...]
Sent: Tuesday, May 17, 2005 3:56 PM
To: Guillermo Gutierrez
Subject: RE: FW: [Dev-C++] Win32 Shell API
When not generating the strings, it's almost the same thing to do:
char *source =3D "hello world";
or:
char source[] =3D "hello world";
When dyanmically generating the file names, then source is of course
declared something like:
char source[2000];
Note that when concatenating multiple file names, you must manually =
insert
the '\0' character after the names, since the string functions will =
break
at the null character.
By the way - why did you unlink the mailing list?
/Per W
On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> hmm...char *source;
> do get a different result if you use "char source" vs "char *source"?
>
> -----Original Message-----
> From: Per Westermark [mailto:pw...@ia...]
> Sent: Tuesday, May 17, 2005 3:31 PM
> To: Guillermo Gutierrez
> Subject: RE: FW: [Dev-C++] Win32 Shell API
>
>
> Minimalistic multi-source -> single directory:
> char *source =3D
> "c:/usr/src/test/test_shfileoperation/src/1.txt\0"
> "c:/usr/src/test/test_shfileoperation/src/2.txt\0"
> "c:/usr/src/test/test_shfileoperation/src/3.txt\0";
> char *dst =3D
> "c:/usr/src/test/test_shfileoperation/dst\0";
> SHFILEOPSTRUCT op;
> memset(&op,0,sizeof(op));
> op.wFunc =3D FO_COPY;
> op.pFrom =3D source;
> op.pTo =3D dst;
> int res =3D SHFileOperation(&op);
>
> (alas hand-copied from Win machine...)
>
> /Per W
>
> On Tue, 17 May 2005, Guillermo Gutierrez wrote:
>
> > I copy to a single destination path.
> >
> > -----Original Message-----
> > From: Per Westermark [mailto:pw...@ia...]
> > Sent: Tuesday, May 17, 2005 3:08 PM
> > To: Guillermo Gutierrez
> > Subject: Re: FW: [Dev-C++] Win32 Shell API
> >
> >
> > Do you copy to a single destination path, or do you specify multiple
> > destinations, i.e. one destination for every source file?
> >
> > /Per W
> >
> > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> >
> > > P.S.S
> > > correction on the error:
> > > windows tells me that it cannot read the files from the source or =
disk. When I click past the initial error, my custom error handling =
message box reveals that the function failed with an error code of '6'.
> > > This works correctly if I only try to copy one file.
> > >
> > > Also, the last part of the path name is generated from the current =
system date by the program that creates the folder (Borland's Final =
Builder), so I have to do some grunt work to get the correct "full" =
path.
> > >
> > > -----Original Message-----
> > > From: Guillermo Gutierrez
> > > Sent: Tuesday, May 17, 2005 2:22 PM
> > > To: 'pw...@ia...'
> > > Subject: RE: [Dev-C++] Win32 Shell API
> > >
> > >
> > > P.S.
> > > The path string that I am copying to is quite shorter than the =
string that I am copying from.
> > >
> > > -----Original Message-----
> > > From: Guillermo Gutierrez
> > > Sent: Tuesday, May 17, 2005 2:19 PM
> > > To: 'Per Westermark'
> > > Subject: RE: [Dev-C++] Win32 Shell API
> > >
> > >
> > > I am not able to get the file copy to work because it appears that =
for some reason the "\0" at the end of each path\filename is not being =
read or the path is too long.
> > >
> > > The path string I am using to copy from is =
"Q:\\QA\\Builds\\Current\\"2005-5-17\\".
> > >
> > > The only thing that changes is the filename that is added at the =
end of the string, I then use the different versions (meaning same =
string with different filename appended) with a null-termination ("\0") =
at the end to create one long string of the 10 files I need to copy. I =
also make sure to add an extra "\0" at the end of the whole string per =
the documentation (that string should be double nul-terminated).
> > >
> > > I get a windows error when the copy function is used stating that =
the file could not be found and it displays the string as one huge =
filename.
> > >
> > > -----Original Message-----
> > > From: Per Westermark [mailto:pw...@ia...]
> > > Sent: Tuesday, May 17, 2005 12:52 PM
> > > To: Guillermo Gutierrez
> > > Subject: RE: [Dev-C++] Win32 Shell API
> > >
> > >
> > > Ok. Now I tested to copy multiple files with a single call. Did =
work. No
> > > problem with the examples I found.
> > >
> > > Back to my previous question: What is wrong with the available =
examples?
> > >
> > > By the way: I started off by googling for
> > > "copying multiple files with SHFileOperation"
> > >
> > > /Per W
> > >
> > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > >
> > > > I have tried looking on google and have found only the same old =
tired examples of how to delete files using the operation or how to copy =
a file with it and how it "should" work to copy multiple files.
> > > >
> > > > I need to copy 10 - 50 files from a rather long path and have =
not been successful using it.
> > > >
> > > > Is that enough info for your liking? or if you like you can go =
into your world, ignore my email, and let someone who cares answer back.
> > > >
> > > > -----Original Message-----
> > > > From: Per Westermark [mailto:pw...@ia...]
> > > > Sent: Tuesday, May 17, 2005 12:16 PM
> > > > To: Guillermo Gutierrez
> > > > Cc: dev...@li...
> > > > Subject: Re: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > Can we expect you to repeat this question until somehow someone =
new to
> > > > this list and takes the time to write something about it? It =
takes quite
> > > > some time to write the answer you like. You can, on the other =
hand, find
> > > > that information without too much google magic.
> > > >
> > > > This is your - at least - third mail about requests for help =
with shell
> > > > copy. And while discussing shell copy - you haven't even =
mentioned any
> > > > special reason for your desperate need for use of this specific =
function,
> > > > or why the answer must come from this list instead of from =
google.
> > > >
> > > > If the google links contains wrong information, or wrong type of
> > > > information, just say so and specify exactly what makes your =
requirements
> > > > completely different from other peoples.
> > > >
> > > > /Per W
> > > >
> > > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > > >
> > > > > Does any one out there have any experience with Windows Shell =
API?
> > > > > Particularly with copying files using 'SHFileOperation()' ?
> > > > >
> > > > > Guillermo Gutierrez
> > > > > Market Scan Information Systems
> > > > > Software Q.A. Supervisor
> > > > > (818) 575-2000 x2427
> > > > > ggu...@ma...
> > > > >
> > > > >
> > > >
> > >
> >
>
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id=16344&op=3Dick
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: Guillermo G. <ggu...@ma...> - 2005-05-17 23:25:11
|
I am using a char SrcPath[20000] variable to hold the name (yes, the =
full string gets close to being that long.)
I fill the array like this:
//LP4 is a variable that holds the source path + filename (lp4.exe)
//SFA - (same as above, source path + "mssfa.exe")
strcpy ( SrcPath, LP4 );
strcat ( SrcPath, "\0");
strcat ( SrcPath, SFA );
strcat ( SrcPath, "\0\0" );
std::cout << "SrcPath: " << SrcPath << endl;
unfortunately the output of "cout << SrcPath" shows both of the paths as =
one that is what is causing the app to think of it as one huge path for =
a file rather than 2 paths/files.
-----Original Message-----
From: Per Westermark [mailto:pw...@ia...]
Sent: Tuesday, May 17, 2005 3:56 PM
To: Guillermo Gutierrez
Subject: RE: FW: [Dev-C++] Win32 Shell API
When not generating the strings, it's almost the same thing to do:
char *source =3D "hello world";
or:
char source[] =3D "hello world";
When dyanmically generating the file names, then source is of course
declared something like:
char source[2000];
Note that when concatenating multiple file names, you must manually =
insert
the '\0' character after the names, since the string functions will =
break
at the null character.
By the way - why did you unlink the mailing list?
/Per W
On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> hmm...char *source;
> do get a different result if you use "char source" vs "char *source"?
>
> -----Original Message-----
> From: Per Westermark [mailto:pw...@ia...]
> Sent: Tuesday, May 17, 2005 3:31 PM
> To: Guillermo Gutierrez
> Subject: RE: FW: [Dev-C++] Win32 Shell API
>
>
> Minimalistic multi-source -> single directory:
> char *source =3D
> "c:/usr/src/test/test_shfileoperation/src/1.txt\0"
> "c:/usr/src/test/test_shfileoperation/src/2.txt\0"
> "c:/usr/src/test/test_shfileoperation/src/3.txt\0";
> char *dst =3D
> "c:/usr/src/test/test_shfileoperation/dst\0";
> SHFILEOPSTRUCT op;
> memset(&op,0,sizeof(op));
> op.wFunc =3D FO_COPY;
> op.pFrom =3D source;
> op.pTo =3D dst;
> int res =3D SHFileOperation(&op);
>
> (alas hand-copied from Win machine...)
>
> /Per W
>
> On Tue, 17 May 2005, Guillermo Gutierrez wrote:
>
> > I copy to a single destination path.
> >
> > -----Original Message-----
> > From: Per Westermark [mailto:pw...@ia...]
> > Sent: Tuesday, May 17, 2005 3:08 PM
> > To: Guillermo Gutierrez
> > Subject: Re: FW: [Dev-C++] Win32 Shell API
> >
> >
> > Do you copy to a single destination path, or do you specify multiple
> > destinations, i.e. one destination for every source file?
> >
> > /Per W
> >
> > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> >
> > > P.S.S
> > > correction on the error:
> > > windows tells me that it cannot read the files from the source or =
disk. When I click past the initial error, my custom error handling =
message box reveals that the function failed with an error code of '6'.
> > > This works correctly if I only try to copy one file.
> > >
> > > Also, the last part of the path name is generated from the current =
system date by the program that creates the folder (Borland's Final =
Builder), so I have to do some grunt work to get the correct "full" =
path.
> > >
> > > -----Original Message-----
> > > From: Guillermo Gutierrez
> > > Sent: Tuesday, May 17, 2005 2:22 PM
> > > To: 'pw...@ia...'
> > > Subject: RE: [Dev-C++] Win32 Shell API
> > >
> > >
> > > P.S.
> > > The path string that I am copying to is quite shorter than the =
string that I am copying from.
> > >
> > > -----Original Message-----
> > > From: Guillermo Gutierrez
> > > Sent: Tuesday, May 17, 2005 2:19 PM
> > > To: 'Per Westermark'
> > > Subject: RE: [Dev-C++] Win32 Shell API
> > >
> > >
> > > I am not able to get the file copy to work because it appears that =
for some reason the "\0" at the end of each path\filename is not being =
read or the path is too long.
> > >
> > > The path string I am using to copy from is =
"Q:\\QA\\Builds\\Current\\"2005-5-17\\".
> > >
> > > The only thing that changes is the filename that is added at the =
end of the string, I then use the different versions (meaning same =
string with different filename appended) with a null-termination ("\0") =
at the end to create one long string of the 10 files I need to copy. I =
also make sure to add an extra "\0" at the end of the whole string per =
the documentation (that string should be double nul-terminated).
> > >
> > > I get a windows error when the copy function is used stating that =
the file could not be found and it displays the string as one huge =
filename.
> > >
> > > -----Original Message-----
> > > From: Per Westermark [mailto:pw...@ia...]
> > > Sent: Tuesday, May 17, 2005 12:52 PM
> > > To: Guillermo Gutierrez
> > > Subject: RE: [Dev-C++] Win32 Shell API
> > >
> > >
> > > Ok. Now I tested to copy multiple files with a single call. Did =
work. No
> > > problem with the examples I found.
> > >
> > > Back to my previous question: What is wrong with the available =
examples?
> > >
> > > By the way: I started off by googling for
> > > "copying multiple files with SHFileOperation"
> > >
> > > /Per W
> > >
> > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > >
> > > > I have tried looking on google and have found only the same old =
tired examples of how to delete files using the operation or how to copy =
a file with it and how it "should" work to copy multiple files.
> > > >
> > > > I need to copy 10 - 50 files from a rather long path and have =
not been successful using it.
> > > >
> > > > Is that enough info for your liking? or if you like you can go =
into your world, ignore my email, and let someone who cares answer back.
> > > >
> > > > -----Original Message-----
> > > > From: Per Westermark [mailto:pw...@ia...]
> > > > Sent: Tuesday, May 17, 2005 12:16 PM
> > > > To: Guillermo Gutierrez
> > > > Cc: dev...@li...
> > > > Subject: Re: [Dev-C++] Win32 Shell API
> > > >
> > > >
> > > > Can we expect you to repeat this question until somehow someone =
new to
> > > > this list and takes the time to write something about it? It =
takes quite
> > > > some time to write the answer you like. You can, on the other =
hand, find
> > > > that information without too much google magic.
> > > >
> > > > This is your - at least - third mail about requests for help =
with shell
> > > > copy. And while discussing shell copy - you haven't even =
mentioned any
> > > > special reason for your desperate need for use of this specific =
function,
> > > > or why the answer must come from this list instead of from =
google.
> > > >
> > > > If the google links contains wrong information, or wrong type of
> > > > information, just say so and specify exactly what makes your =
requirements
> > > > completely different from other peoples.
> > > >
> > > > /Per W
> > > >
> > > > On Tue, 17 May 2005, Guillermo Gutierrez wrote:
> > > >
> > > > > Does any one out there have any experience with Windows Shell =
API?
> > > > > Particularly with copying files using 'SHFileOperation()' ?
> > > > >
> > > > > Guillermo Gutierrez
> > > > > Market Scan Information Systems
> > > > > Software Q.A. Supervisor
> > > > > (818) 575-2000 x2427
> > > > > ggu...@ma...
> > > > >
> > > > >
> > > >
> > >
> >
>
|
|
From: Reid T. <Rei...@at...> - 2005-05-17 21:57:03
|
i think google will work for that too
=20
reid=20
-----Original Message-----
From: Alexsandro Meireles [mailto:mei...@gm...]=20
Sent: Tuesday, May 17, 2005 5:34 PM
To: Per Westermark
Cc: Dev C++
Subject: Re: [Dev-C++] Cp vs. copy
Hi!
=20
Could you please tell me where I can download such win-32 compatible
port of the cp command?
=20
Thanks in advance,
=20
Alex.
=20
On 5/17/05, Per Westermark <pw...@ia...> wrote:=20
Some - non-complete - notes about copy:
copy will preserve date/time of last write.
copy will modify date/time of last access=20
copy will modify date/time of file creation
copy will append archive flag
copy will remove read-only flag
copy will not even find system file
copy will not even find hidden file
In short - copy is inferior to cp.=20
Simple solution: Download a win32-compatible port of the cp command.
/Per W
On Tue, 17 May 2005, Alexsandro Meireles wrote:
> Hi, all!
> I need to translate the system command cp -p to work with Windows.=20
> Does anyone know if dos copy translate exactly what cp -p?
> Syntax are as follows:
> LINUX: system("cp -p $oldname $newname");
> WINDOWS: system("copy $oldname $newname");=20
> I am not sure if copy can copy from one file to the other with
EXACTLY the
> same attribute as -p does.
> Thanks in advance!
> Best,
>
> --
> Alexsandro Meireles
>
--=20
Alexsandro Meireles
|
|
From: Alexsandro M. <mei...@gm...> - 2005-05-17 21:34:07
|
Hi!
Could you please tell me where I can download such win-32 compatible port=
=20
of the cp command?
Thanks in advance,
Alex.
On 5/17/05, Per Westermark <pw...@ia...> wrote:=20
>=20
> Some - non-complete - notes about copy:
>=20
> copy will preserve date/time of last write.
> copy will modify date/time of last access
> copy will modify date/time of file creation
> copy will append archive flag
> copy will remove read-only flag
> copy will not even find system file
> copy will not even find hidden file
>=20
> In short - copy is inferior to cp.
>=20
> Simple solution: Download a win32-compatible port of the cp command.
>=20
> /Per W
>=20
> On Tue, 17 May 2005, Alexsandro Meireles wrote:
>=20
> > Hi, all!
> > I need to translate the system command cp -p to work with Windows.
> > Does anyone know if dos copy translate exactly what cp -p?
> > Syntax are as follows:
> > LINUX: system("cp -p $oldname $newname");
> > WINDOWS: system("copy $oldname $newname");
> > I am not sure if copy can copy from one file to the other with EXACTLY=
=20
> the
> > same attribute as -p does.
> > Thanks in advance!
> > Best,
> >
> > --
> > Alexsandro Meireles
> >
>=20
>=20
--=20
Alexsandro Meireles
|
|
From: Gary W. <ga...@gm...> - 2005-05-17 20:03:07
|
Hi, I'm using 4.9.9.2 <http://4.9.9.2> with the latest update. One day my=20 debugger stops working, and when I click "debug" some thread is created (yo= u=20 can see the process appear in the Windows Task Manager) but the usual=20 console screen does not appear.=20 When I *run* the program normally, the console appears and the program does= =20 its thing, but when I *debug* nothing at all appears, though Dev-C++ does= =20 seem to switch into debug mode (the little buttons for compile and run=20 become unavailable). I've tried reinstalling and configuring the linker under project options to= =20 "show debugging information" but none of this works. Any advice on how to= =20 fix it would be a huge help. Thanks, Gary |
|
From: <Mat...@Ve...> - 2005-05-17 19:58:47
|
This is what is needed: http://unxutils.sourceforge.net/ <http://unxutils.sourceforge.net/> It will not depend on any stupid compatibility DLLs. -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of Alfred P. Reaud Sent: Tuesday, May 17, 2005 12:50 PM To: Dev-Cpp UserList Subject: Re: [Dev-C++] Cp vs. copy You can also use the DOS xcopy /k to copy attributes. However, Per is right, and if you use Mingw and/or Msys then you can use cp via DOS. Read the help on xcopy as there are quite a few options. Per Westermark <pw...@ia...> wrote: Some - non-complete - notes about copy: copy will preserve date/time of last write. copy will modify date/time of last access copy will modify date/time of file creation copy will append archive flag copy will remove read-only flag copy will not even find system file copy will not even find hidden file In short - copy is inferior to cp. Simple solution: Download a win32-compatible port of the cp command. /Per W On Tue, 17 May 2005, Alexsandro Meireles wrote: > Hi, all! > I need to translate the system command cp -p to work with Windows. > Does anyone know if dos copy translate exactly what cp -p? > Syntax are as follows: > LINUX: system("cp -p $oldname $newname"); > WINDOWS: system("copy $oldname $newname"); > I am not sure if copy can copy from one file to the other with EXACTLY the > same attribute as -p does. > Thanks in advance! > Best, > > -- > Alexsandro Meireles > ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users Alfred P. Reaud <mailto:al...@ya...> <http://www.geocities.com/alreaud/> ___________________________________________________________________ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. |