How can I make it work? Use fgets instead. (Note: It's not your fault. You are doing illegal things. But if you think you do, char * foo = malloc( SOMESIZE ); –anon Jun 6 '10 at 17:57 The way you are doing this will never be safe.

If it reads between 0 and 4, you'll have junk leftover in your strings, which could lead to the bus error. –Adam Rosenfield Oct 8 '11 at 2:03 add a comment| it'll write one okay, but if i want more than one, then it chokes and prints a whole bunch of crap to the file. im not even sure how i should store the array in the file... ...*pulling hairs* eat, drink and be merry. Anonymous form close (x) Front Page Mac Blog iOS Blog Roundups AirPort Apple Car Apple Deals Apple Pay Apple Stores Apple TV Apple VR Project

im trying to multiply the encryptnumber variable to the messagepart variable to encrypt it. When compiled and ran in Snow Leopard, it worked just fine. when a file is open with "r", it's not created if it doesn't exit. Please reply 2.

Any help much appreciated. So, no answer to your problem - but some code for you to try. Discussion in 'Mac Programming' started by kdum8, Apr 28, 2009. more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed

A better way to evaluate a certain determinant Change JPEG ColorSpace Encoding value What happens when 2 Blade Barriers intersect? i also got an error that said "bus error"...i've never seen that before, can anyone explain? Running different window managers simultaneously 9. Most Liked Posts kdum8, Apr 28, 2009 kdum8 macrumors 6502a Joined: Sep 8, 2006 Location: Tokyo, Japan #1 Hi, I am still a C beginner so I may have missed something

Forum Today's Posts C and C++ FAQ Forum Actions Mark Forums Read Quick Links View Forum Leaders What's New? This is the road to unsafe and fragile C programs, for which C is infamous: Whatever size you allocate to foo, a user of the program can always overflow it and Nov 14 '05 #4 This discussion thread is closed Start new discussion Replies have been disabled for this discussion. Dec 24, 2008 at 1:05pm UTC cyberpirate (38) i made "message.txt" i made shur that wasnt the problem ;) Dec 24, 2008 at 1:46pm UTC guestgulkan (2942) This bit on line

Yes, my password is: Forgot your password? eat, drink and be merry. In the United States is racial, ethnic, or national preference an acceptable hiring practice for departments or companies in some situations? Let us know a.

This will give you a result, but you are not using that result, therefore 'nothing has been accomplished' - if you see what I mean. How many answers does this question have? Developing web applications for long lifespan (20+ years) Review paper/book on Finite Difference Methods for PDEs Can I buy my plane ticket to exit the US to Mexico? please help me with this one, i need this program to run as soon as possible.

I am running this on a MBP using OS 10.5.6 in the terminal. Either allocate it on the stack. Last edited by breanne; 08-23-2002 at 02:23 AM. Try not.

Try fgets in conjunction with something else for(y=0; y < x; y++) { size_t length; fgets(words[y], 20, fp); length = strlen(words[y]); /*remove newline if it is there*/ if(words[y][length] == '\n') { The last line of data exploits your change in pattern and contains a comma in the 'last field'. if I remove the last %*c, which is meant to consume the '\n' and ignore it so as to advance to the next line, the program does not crash. How much interest should I pay on a loan from a friend?

One thing you may want to consider is to fgets the entire line into a buffer and the sscanf it. how can i accomplish this? I compiled using gcc. share Share on Twitter Share on Facebook Email Link Like + Quote Reply (You must log in or sign up to post here.) Show Ignored Content Share This Page Log in

Why would a password requirement prohibit a number in the last character? Reaching the end of the string in sscanf() is equivalent to encountering end-of-file for fscanf(). Then, the stream is rewinded and both values are read with fscanf. I dont know how to fix this. Error using ==> fscanf The file identifier must be of class double. A dash (-) that is not the first character may produce non-portable behavior in some library implementations. [^characters]Negated scansetAny number of c...

If a read error occurs, the error indicator for the stream is set, EOF shall be returned, [CX] and errno shall be set to indicate the error. share|improve this answer answered Apr 26 '11 at 18:26 R.. 127k15189421 @R: I was having a hard time following the man page for fscanf. The application shall ensure that the corresponding argument is a pointer to the initial byte of an array of char, signed char, or unsigned char large enough to accept the sequence. The last step can be done by