f



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

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.

0
Fonarix
9/20/2006 1:36:50 PM
comp.sys.mac.programmer.help 4653 articles. 2 followers. Post Follow

9 Replies
452 Views

Similar Articles

[PageSpeed] 41

In article <1158759410.713967.100750@m7g2000cwm.googlegroups.com>,
 "Fonarix" <fonarix@ukr.net> wrote:

> 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.


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.
0
David
9/20/2006 1:44:01 PM
Fonarix =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=B2:
> 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!!!!!!!!!!!!!!!!

0
Beavis
9/20/2006 1:44:53 PM
> 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!

0
Fonarix
9/20/2006 1:52:09 PM
CkRhdmlkIFBoaWxsaXAgT3N0ZXIg0L3QsNC/0LjRgdCw0LI6CkFycmUgeW91IG9Zc3Rlcj8/Pz8/
P0Z1Y2sgISEhIUkndmUgc21lIHByb2JsZW0hCkZVQ0shCg==

0
Beavis
9/20/2006 2:13:52 PM
Beavis �������:
> David Phillip Oster �������:
> Arre you oYster??????Fuck !!!!I've sme problem!
> FUCK!

Sorry!
I'll kill myself by the wall!

0
Beavis
9/20/2006 2:40:39 PM
> 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.

0
Fonarix
9/20/2006 2:51:48 PM
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!!!

0
Fonarix
9/21/2006 6:42:27 AM
Fonarix =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=B2:
> 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.
>=20
>=20
> Thanks!!!

FUCK!

0
Beavis
9/21/2006 6:52:39 AM
Beavis =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=B2:

>
> 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
Beavis
9/25/2006 7:53:00 AM
Reply:

Similar Artilces:

No Mac Help in Mac Help?
When I go to Mac Help in Finder (latest version of OSX Tiger) I get nothing. The window pops up but it's blank. Click on the little house and the initial screen fills in but nothing beyond that. I had a simiar problem with Safari help some time back and someone suggested I remove a folder from Library/Caches, (com.apple.helpui or something similar) and that did the trick for Safari's help. I honestly don't recall if I've ever had the Mac Help or I've just never used it since this machine. The problem happens on or offline so I'm not sure where the Mac Help file re...

HELP Mac OS-X USB HID problems... PLEASE HELP!
Hi, I am developing a non standard (i.e. non mouse keyboard type) HID device to act as a interface between the Microchip 2550 PIC and a Mac running OS-X (10.3.9). I have managed to develop a HID app working under Windows OS, but I'm having trouble with the Mac implementation. The Mac sees and reports the device correctly - an 'ioreg' listing shows that all the parameters are as expected. The only exception is the element list which seems to be huge and largely composed of element params which are a little odd, however, I've seen a similar list on the keyboard so I&...

Help! iSync mac to mac
Am I right in saying that with iSync, if you want to sync 2 macs together (address book, iCal etc.) the only way to do this is via a ..Mac account, even if those computers are sitting not 5 feet from each other, both Airport equipped? If this is the case, I've never heard anything so ridiculous. Is this just part of another apple scam to get more money out of us? Does anyone know if this is indeed the case, and can you recommend any other sync software out there? I'm setting up an iMac, eMac and powerbook g4 for a friend's office, all running OSX Panther, and you'd think basi...

Help please burning a IMG file of a MAC program on a PC for a MAC user
Hi all, I have an IMG file and I don't know what program created it although I do know that it is an image file of a MAC program. My question is, Is there a way that I can use my PC to burn this image file to a MAC usable state for a friend so that I can give him the CD and he can install the program on his MAC? If so could you please provide step by step "idiot proof" instructions for me? Any help will be very much appreciated. I have the following: Plextor 48/24/48A CD-RW and Nero, Adaptec Easy CD creator 6, Clone CD and WinISO. Can it be done with these or do I need ...

Copy Files from IIGS to Mac to PC
Here's the whole situation, I hope I'm posting in the right area. I have an Apple IIGS with files that I want to get to a PC. From the feedback I've gotten the easiest way to do this is to get a Macintosh to read the 800K floppies from the IIGS and then write those files back to a PC floppy (using the Mac). I have a Macintosh SE with a Superdrive. From what I can tell, however, it can't read PC floppies. It's running system 7.0.1, and from what I've read, it's not possible to get that OS to read PC floppies. Apparently I need system 7.1 to do this? Furthermor...

Please help w/burning a IMG file of a MAC program with a PC for a MAC user
Hi all, I have an IMG file and I don't know what program created it although I do know that it is an image file of a MAC program. My question is, Is there a way that I can use my PC to burn this image file to a MAC usable state for a friend so that I can give him the CD and he can install the program on his MAC? If so could you please provide step by step "idiot proof" instructions for me? Any help will be very much appreciated. I have the following: Plextor 48/24/48A CD-RW and Nero, Adaptec Easy CD creator 6, Clone CD and WinISO. Can it be done with these or do I need something ...

Help Help Help Help Help
please,help us . we have a seious problem, we are designing a radio controlled car that is guided by the PC, to send the data wireless between the PC and the Car and vice versa. we use 2 transmitter/reciever circuits from 2 seperate radio controlled car each running with a different frequency (27 MHz & 40 MHz)and modify the functionality of each to do the disered work. but on mounting a transmitter(40MHz) and reciever(27MHz) on the car, and attach another transmitter(27MHz) and reciever(40MHz) to the PC; we found that on sending signals from the car to the PC on the transmitter & rec...

help!help!help!help!
I am a student.I am going to make a simulation of a robot (FANUC Robot M-16iB) under the matlab\simulink environment . It is a normal 6DOF robot.I want to realize any angle and any speed (under the max speed) and any position and orientation control. As I just starting to do this new field,I have no experience about it. Can you give me some simulation demo or examples for 6DOF robot? I am very eager to get these.Please write back to me as soon as possible,thank you! Sincerely, Connie&#12288;&#12288;&#12288;&#12288;&#12288;&#12288;&#12288; zhanglijuan920@sohu.c...

HELP HELP PLEASE HELP
i have written a slighly bastardized version of the class web page which is given as an example of how to use the html tokenizer. What I've written is: def parse(host) dict = { } @body= host.getHTML() if !@body return end theTags = ['select','input'] for x in theTags do tokenizer = HTMLTokenizer.new(@body) while tag = tokenizer.getTag(x) name = tag.attr_hash['name'] type = tag.attr_hash['type'] if name != nil then dict[type]=name ...

Help Help Help
Hi everybody there... I want to develop an application that uses GUIDE and will have two windows figures(figure1 and figure2). In figure1 the user will write down in a text box a string. Then figure1 closes, load figure2 and use that string. Finally, I would like to ask how can I use mouse click event. I would really appreciate any help of you. Thank you in advance.. NM Hi, see examples in the documentation : http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/exampleindex.html J�r�me On Mar 14, 12:38 pm, nm <nmihaili...@gmail.com> wrote: > Hi everybody ther...

Help! I've Been Forced To Use A Mac, Online Help for Mac?
http://www.suggestafix.com/index.php?showtopic=33751 Help! I've Been Forced To Use A Mac, Online Help for Mac? Aug 29 2009, 12:23 PM Post #1 Group: Star Member Posts: 297 Joined: 31-May 06 Member No.: 14,025 Today, for a hopefully brief period of time, I'm being forced to use a Mac. Since these machines are incomprehensible, I need a simple piece of information*. I know this is heresy, but . . er . . is there anywhere on the Net where peeps answer questions without offering them the choice of (1) $15 (2) $25 or (3) $50 for the answer. ~ beau (but don't tell anyone I asked...

MDI on mac
------_=_NextPart_001_01C755D1.B10C7B14 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, WX: 2.8.1 OS: Mac OS-X, Carbon app Compiler: XCode 2.4.1 using GCC 4.0.1 I already posted this question and got no help. I tried looking at this further, and I still can't figure out what I'm doing wrong. I'm a WX newbie, so I hope I'm not wasting anyone's time with a stupid question. I've tried a lot of things to solve this, and tried the forums as well, and so far it hasn't helped. I've encounter...

Mac Os 9 Please help !
Does anybody know where i can download Mac Os 9 ??? Can't use the cd anymore and just have a new hard disc please help ! In article <BC5C2A35.18A%cindy@orange.nl>, cindy <cindy@orange.nl> wrote: > Does anybody know where i can download Mac Os 9 ??? > Can't use the cd anymore and just have a new hard disc > please help ! > You can't legally download Mac operating systems later than OS 7.5.5. You can download some OS updates such as 8.6, 9.1, or 9.2.1 at: http://kbase.info.apple.com/mainpage but that probably won't help you any. ...

Mac OS / HotSync question
I'm using a G4 running OS 9.2 and a Tungsten T with HotSync USB cradle. Just recently I started having trouble hotsyncing without making and intentional changes to my software or computer. When I press the hotsync nothing happens. When I try to double click on the hotsync icon in the Plam folder I get a message: "The application "HotSync Manager" has unexpectedly quit, because an error of type 2 occurred. I uninstalled the palm software with the installer and reinstalled the software (Palm Desktop 4.2.1, HotSync Manager 3.2). No change. Any suggestions ...

Mac OS / HotSync question
I'm using a G4 running OS 9.2 and a Tungsten T with HotSync USB cradle. Just recently I started having trouble hotsyncing without making and intentional changes to my software or computer. When I press the hotsync nothing happens. When I try to double click on the hotsync icon in the Plam folder I get a message: "The application "HotSync Manager" has unexpectedly quit, because an error of type 2 occurred. I uninstalled the palm software with the installer and reinstalled the software (Palm Desktop 4.2.1, HotSync Manager 3.2). No change. Any suggestions on how to get ...

Help, Help, Help...
Hei! Im makin a hot INVADERS game with Java but im a newbie with language, so , question is how do i use KeyPressed () function... I hav Applet Runnable... -!Hei!- Here is my problem... public class TestinKeys extends Applet implements Runnable .... .... public void run () { while ( true ) { KeyEvent ke; if ( ke.getKeyChar() == 'a' ) g_TykkiX ++; .... .... What is Wrong, im tryin to make that Invaders game but i dont know how to read keyboard with Runnable Java code... JariTapio <JariTapio@pp.inet.fi> wrote: > publi...

MAC Help Requested! � Mac & ISO files?�
Does anyone know of any Mac software, 9.X or OSX, that can handle ISO segmented files? Thanks In article <bob-0012AF.22044402042004@news1.mts.net>, - <bob@bob.com> wrote: > Does anyone know of any Mac software, 9.X or OSX, that can handle ISO > segmented files? > > Thanks What application creates them? There's nothing on MacOS X that uses ISO files. -- DeeDee, don't press that button! DeeDee! NO! Dee... - <bob@bob.com> wrote: > Does anyone know of any Mac software, 9.X or OSX, that can handle ISO > segmented files? Do you mean...

help help help
hi all im new to linux can anyone tell me the best place to get some help installing programs in linux or best books to read -- --------------------------------- --- -- - Posted with NewsLeecher v3.7 Final Web @ http://www.newsleecher.com/?usenet ------------------- ----- ---- -- - peteware wrote: > hi all im new to linux can anyone tell me the best place to get some > help installing programs in linux or best books to read > > > -- > --------------------------------- --- -- - > Posted with NewsLeecher v3.7 Final > Web @ http://www.newsleecher.com/?usenet > -...

help help help
I need to refresh my C knowledge quickly. I will be reading code for simple industrial type controls like motor controllers, valve drivers, etc This software is pretty simple, 3000 lines max. The executable is embedded in flash on the processor chip. Actually I haven't seen it yet. I haven't looked at C or done any programming in ages. I'm looking for a simple programming suite that will run on my WinXP (NTFS) computer. Something that doesn't take really long to get up to speed with. Simple is better. I just need to practice and remember and do some simple experi...

HELP HELP HELP
Hello everyone, I am a freshmen at a computer university and also new to C++ . I havent used C before either but been through PASCAL and GW-BASIC. Can someone please tell me the link to download the C++ compiler which can run on my Windows XP Professional Edition. Thanks. ByE. Yours forever in Digital Paradise uSmAn could have typed what u wanted in google. "Usman" <game_pk@hotmail.com> wrote in message news:buobgo$kaacm$1@ID-217624.news.uni-berlin.de... > Hello everyone, > I am a freshmen at a computer university and also new to C++ . I havent used > C before eit...

HELP-HELP-HELP!!!!!!!!!!
On this site par example: http://communications.siemens.com/cds/frontdoor/0,2241,nl_nl_0_27443_rArNrNrNrN,00.html u have a 3d animation, like many other sites...but if i want to see this a new window opens and i see a icon with ared cross in it. also on sites with games i see this... What is my problem? I have winXP-Pro firewall is out and sec. is on low..... twan1@home.nl (Twan) writes: > On this site par example: > http://communications.siemens.com/cds/frontdoor/0,2241,nl_nl_0_27443_rArNrNrNrN,00.html > u have a 3d animation, like many other sites...but if i want to...

Help Help Help
Hello, I am a reluctant user of the website ntsearch.com. I accidentally download a Java program called "dict" from an ebook website to my XP and now every English words that I read from my computer has got a link with your web. I found it very frustrating when I noticed all the chinese characters I read from the web now become loads of question marks. I think it has a link with the program that I accidentally downloaded from that ebook website. How can I remove the so called "dict" program and other Java Scripts from my computer? This is very urgent and please answer my ...

Help Help Help
Hello, I am a reluctant user of the website ntsearch.com. I accidentally download a Java program called "dict" from an ebook website to my XP and now every English words that I read from my computer has got a link with your web. I found it very frustrating when I noticed all the chinese characters I read from the web now become loads of question marks. I think it has a link with the program that I accidentally downloaded from that ebook website. How can I remove the so called "dict" program and other Java Scripts from my computer? This is very urgent and please answer my ...

Help Help Help
Q1 I want to know how to show the 8 bit planes of the image?? Q2 And also find edges of image by showing both edge magnitude and direction?? ...

Web resources about - Copying files om Mac OS... please Help! XCode! - comp.sys.mac.programmer.help

Private copying levy - Wikipedia, the free encyclopedia
A private copying levy (also known as blank media tax or levy ) is a government -mandated scheme in which a special tax or levy (additional to ...

Zynga CEO Dispels Facebook Game Copying Accusations
... they are like the crew mechanic in our games. They give you a new way to interact with your friends. Zynga was also accused last week of copying ...

Showing Apple employee #8 some of my artifacts. He remembers manually copying the Star Wars cassettes ...
jurvetson posted a photo: He has a rig that fed eight recoding tape drives from one master, and he would manually copy eight tapes at a time ...

The Secret Pattern That Stops You Copying Bank Notes - YouTube
http://tomscott.com - @tomscott - There's a hidden pattern on banknotes, all around the world, that means photocopiers refuse to copy them.

CSAIL fixes software bugs automatically, in any language, by copying from safer applications
A new system can repair bugs in software using smart processing that imports functionality from other programs, all without access to source ...

Australia risks copying US 'ag-gag' laws to turn animal activists into terrorists
When Amy Meyer saw a sick cow being pushed by a bulldozer outside a slaughterhouse, she did what any of us would in this age of iPhones and Instagram ...

Hardware vendors sue Dutch government over copyright levies - regulation, legal, Dutch Home Copying Foundation ...
... on hard disks, smartphones, tablets and MP3 players that are meant to compensate the music and movie industries for losses caused by home copying. ...

Grace Jones slams Lady Gaga for copying her, describes her as soulless - The Courier-Mail Search Search ...
GRACE Jones has slammed Lady Gaga in a new interview, saying she didn’t “feel a soul” when she met the controversial pop star.

Iran claims to be copying US drone
CTV.ca Iran claims to be copying US drone Herald Sun AN IRANIAN military commander said the country is building a copy of a US spy drone captured ...

Ex-cop pleads guilty to copying sex video
A former officer has pleaded guilty to copying a private sex video he found on the mobile phone of a victim who came to police for help last ...

Resources last updated: 2/18/2016 10:18:34 AM