| Author |
string help stuff...
|
Justin Fox
Ranch Hand
Joined: Jan 24, 2006
Posts: 802
|
|
ok i know this isnt a java question, but this is the best online forum for programmers so here it goes... umm, i'm using C in my computer networks class... and in one program they initiate a character array of a defined BUFFSIZE. like so: char buff[BUFFSIZE]; and they use readln to get user input and store it into that array. like so: now, i want to send an error message if, when i try to read a file, it returns null.. i know how to create a char[] but how do i store the string say: " file did not exist, was created" into the char[] in C please help me, Justin
|
You down with OOP? Yeah you know me!
|
 |
Srinivas Kalvala
Ranch Hand
Joined: Oct 20, 2005
Posts: 257
|
|
Hello, memcopy() and memset() will help. Try them Refer: Unix Network programming by Stevens
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16680
|
|
As already mentioned, in order to copy strings around, you can use the memcopy() function. To create a string with a value, I believe it is... Of course, my "C" is incredibly rusty... Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
Note that in C it should be memcpy without the o, not memcopy. For strings you should use strcpy instead of memcpy. [ September 14, 2006: Message edited by: Jesper Young ]
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Rusty Shackleford
Ranch Hand
Joined: Jan 03, 2006
Posts: 490
|
|
http://www.programmersheaven.com/c/MsgBoard/grouplist.asp?Setting=A0001F2001 has a bunch of great C boards, along with lots of other subjects. I think it is the best all around programming board. The Java boards are pretty dead, but the boards labeled C/C++ are quite active and the regulars are not only nice, but extremely knowledgable in CS topics. It sounds like you are in need of a good beginners book. Didn't this class have C as a prereq? A Book on C is an outstanding book that covers ANSI C. And as noted, Unix Network Programming is the definitive networking book, although it actually expects the reader to be comfortable in the basics of C, which is more then fair.
|
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
|
 |
 |
|
|
subject: string help stuff...
|
|
|