Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

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

4 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Fonarix

ungelesen,
20.09.2006, 09:36:5020.09.06
an

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

ungelesen,
20.09.2006, 09:44:0120.09.06
an
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

ungelesen,
20.09.2006, 09:44:5320.09.06
an

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

ungelesen,
20.09.2006, 09:52:0920.09.06
an
> 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

ungelesen,
20.09.2006, 10:13:5220.09.06
an

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

Beavis

ungelesen,
20.09.2006, 10:40:3920.09.06
an

Beavis написав:

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

Sorry!
I'll kill myself by the wall!

Fonarix

ungelesen,
20.09.2006, 10:51:4820.09.06
an
> 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

ungelesen,
21.09.2006, 02:42:2721.09.06
an
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

ungelesen,
21.09.2006, 02:52:3921.09.06
an

Fonarix написав:

FUCK!

Beavis

ungelesen,
25.09.2006, 03:53:0025.09.06
an

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 neue Nachrichten