Google 网上论坛不再支持新的 Usenet 帖子或订阅项。历史内容仍可供查看。

Copying files om Mac OS... please Help! XCode!

已查看 4 次
跳至第一个未读帖子

Fonarix

未读,
2006年9月20日 09:36:502006/9/20
收件人

I'm trying to copy file on the same volume,
File is a shared library; in the source directory it's size 16 Kbytes.
After copying it's size 6 KB, and it has type Excel file!!! ))) And
it's doesn't work!


Procedure:

OSStatus DoStupidCopy(char *pszSrcPath, char *pszDestDir)
{
static const int iBufSize= 4*4096;
char pBuf[iBufSize];

FILE* fSource = fopen(pszSrcPath,"rb");
if (!fSource)
return 1;//throw "Can't open file";
FILE* fTarget = fopen(pszDestDir,"wb");
if (!fTarget)
return 1;//throw "Can't write file";
int len;
while ( len = fread( pBuf, sizeof(char), iBufSize, fSource ) )
{
fwrite(pBuf, sizeof(char), len, fTarget);
}
fclose(fSource);
fclose(fTarget);
return noErr;
}


I've spent a lot of time to learn how to use MoreFilesX but I can't do
anything with it.

Beforehand thanks.

David Phillip Oster

未读,
2006年9月20日 09:44:012006/9/20
收件人
In article <1158759410.7...@m7g2000cwm.googlegroups.com>,
"Fonarix" <fon...@ukr.net> wrote:


From the man page for fread:
---------------
The functions fread() and fwrite() advance the file position indicator
for the stream by the number of bytes read or written. They return the
number of objects read or written. If an error occurs, or the end-offile
is reached, the return value is a short object count (or zero).

The function fread() does not distinguish between end-of-file and error,
and callers must use feof(3) and ferror(3) to determine which occurred.
The function fwrite() returns a value less than nmemb only if a write
error has occurred.
---------------

Please rewrite your example to properly check the return values of fread
and fwrite, and if you still have a problem, ask again.

Also, don't forget Bundles (folders that the Finder presents as a
single, file-like object. For example, .framework files), and resource
forks.

Beavis

未读,
2006年9月20日 09:44:532006/9/20
收件人

Fonarix написав:

> I'm trying to copy file on the same volume,
> File is a shared library; in the source directory it's size 16 Kbytes.
> After copying it's size 6 KB, and it has type Excel file!!! ))) And
> it's doesn't work!


He-he-dude)
RRRRRRRRRRRRRRRR!!!!!!!!!!!!!!!!

Fonarix

未读,
2006年9月20日 09:52:092006/9/20
收件人
> From the man page for fread:
> ---------------
> The functions fread() and fwrite() advance the file position indicator
> for the stream by the number of bytes read or written. They return the
> number of objects read or written. If an error occurs, or the end-offile
> is reached, the return value is a short object count (or zero).
>
> The function fread() does not distinguish between end-of-file and error,
> and callers must use feof(3) and ferror(3) to determine which occurred.
> The function fwrite() returns a value less than nmemb only if a write
> error has occurred.
> ---------------
>
> Please rewrite your example to properly check the return values of fread
> and fwrite, and if you still have a problem, ask again.
>
> Also, don't forget Bundles (folders that the Finder presents as a
> single, file-like object. For example, .framework files), and resource
> forks.


In this case how can I copy bundle? (Shared library made on codewarrior
compiler).
This file in Midnight commander is present as one file, and it's size
6 KB but in finder 16! After copying in MC it's size still 6 KB and
in finder too!

Beavis

未读,
2006年9月20日 10:13:522006/9/20
收件人

David Phillip Oster написав:
Arre you oYster??????Fuck !!!!I've sme problem!
FUCK!

Beavis

未读,
2006年9月20日 10:40:392006/9/20
收件人

Beavis написав:

> David Phillip Oster написав:
> Arre you oYster??????Fuck !!!!I've sme problem!
> FUCK!

Sorry!
I'll kill myself by the wall!

Fonarix

未读,
2006年9月20日 10:51:482006/9/20
收件人
> From the man page for fread:
> ---------------
> The functions fread() and fwrite() advance the file position indicator
> for the stream by the number of bytes read or written. They return the
> number of objects read or written. If an error occurs, or the end-offile
> is reached, the return value is a short object count (or zero).
>
> The function fread() does not distinguish between end-of-file and error,
> and callers must use feof(3) and ferror(3) to determine which occurred.
> The function fwrite() returns a value less than nmemb only if a write
> error has occurred.
> ---------------
>
> Please rewrite your example to properly check the return values of fread
> and fwrite, and if you still have a problem, ask again.
>
> Also, don't forget Bundles (folders that the Finder presents as a
> single, file-like object. For example, .framework files), and resource
> forks.


This code works well in debugger... Source file size 6190 destination
file size 6190, in finder 16 KB! Have Mac OS some function which I can
use And copy it successful???
Also I tried to use: status = ::PBHCopyFileSync(&paramBlock) ;
But I got status is -50 for local volume.
Thanks.

Fonarix

未读,
2006年9月21日 02:42:272006/9/21
收件人
I've found this:

Incidentally, FSCopyObject does not work correctly on 10.4 -- it does
not copy
HSF+ Extended Attributes -- so the correct solution here is to call
FSCopyObjectSync from the OS on 10.4 and later, and only use the
FSCopyObject
sample code on 10.3.


Thanks!!!

Beavis

未读,
2006年9月21日 02:52:392006/9/21
收件人

Fonarix написав:

FUCK!

Beavis

未读,
2006年9月25日 03:53:002006/9/25
收件人

Beavis написав:

>
> FUCK!

So...nobody here...i feel so alone ...where ary yo, fishhead?Are you
dead?
Who am i?
Where is butthead?
So many questions...so few answers...so fuckingly few drugs...fuck...
mac!os!x!
aaaaa!
mac's!!!
it's so big!!!
Fuckin' cheese!!!
No more mushrooms!!!
sick my duck!
Chao!

0 个新帖子