123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|612|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> C/C++/C#/Other -> C and txt files

Posted : Tuesday, 17 July 2007, 07:53
iusinbello


-=-=-


Posted : Tuesday, 17 July 2007, 07:58
garand
It might just be me but that code looks a little complicated for what you are trying to do. I dont know much C at all but in C# I would get a substring from the beginning to the "$" and from the $ to the end. Strip the "$" from it and store each in different variables. Then you would have the txt file and password nomatter how long each of them is. good luck and if i get some time ill try to figure out something for C
Posted : Tuesday, 17 July 2007, 08:54
Jayenkai


Stupid C Char returns!
Took a few goes to get that working right, but that function should come in handy for you!

-=-=-
''Load, Next List!''
Posted : Tuesday, 17 July 2007, 08:59
iusinbello
Thanks Jay but this is not what I am asking for.
I need to understand why when I try to get a string from a .txt i get weird symbols in it...

P.s. ty garand.

-=-=-


Posted : Tuesday, 17 July 2007, 09:27
Jayenkai
Oh, well in that case it's probably the old "Assuming it's blank" issue.

Never assume that a variable is nothing when using C.


So, whenever you add a letter to the end of a char, you should always add a [0] to the point right after it.
In your case : namein[i] = bit; namein[i+1]=0;

-=-=-
''Load, Next List!''
Posted : Tuesday, 17 July 2007, 09:58
iusinbello
w00t!! ty now it works fine!
My last question>> why when you declare an array you use
char* name[number]
instead of
char name[number] ???

P.s. i hope those little banners on my sign arent annoying...

-=-=-


Posted : Tuesday, 17 July 2007, 10:11
Jayenkai
I started using char* a while back.
To be honest, I'm still not 100% sure what works better.
I think "Char* name" is "Amount of space for text that's this length" and "Char name[number]" is "Amount of space 'number' length" but I might be wrong. I tend to avoid all types of string in C

-=-=-
''Load, Next List!''
Posted : Wednesday, 18 July 2007, 16:39
Yayyak

allocates space for a pointer to a set of chars. It does not allocate space for the string.

does basically the same thing.

allocates the pointer, but also the memory for the string itself (of length number).

AFAIK, of course. I don't have my set of bibles with me (in philosophy class...).

Posted : Wednesday, 18 July 2007, 18:17
Jayenkai
^ 3 perfectly good reasons to avoid using C!
Posted : Wednesday, 18 July 2007, 19:42
Yayyak
That may be true in some cases. I don't develop web applications in C.

C is, however, the lingua franca of computer science. It's also used a lot in library and system development. Even if you don't use it, you still have to put up with it and get used to it.

Plus, it's not that hard, really. Especially compared to the language behemoth that C++ is.