jephthah 1,888 Posting Maven

and here's a variation that's even less elegant, but more simple, assuming you can use standard C libraries

#include <string.h> 

char longString[3000], splitString[100][30];
int stringLen, index;

// "longString" is filled with a null-terminated string of chars

stringLen = strlen(longString);
index = 0;

while (index*30 < stringLen)
{
    strncpy(splitString[index], &longString[index*30], 30);
    index++;
}

note that the split strings will not be null-terminated, the unused array elements are uninitialized, the use of arbitrary "magic numbers" (30), and the complete lack of error checking make this entirely unacceptable for commercial or industrial use. i give it here for illustrative purposes only.


.

jephthah 1,888 Posting Maven

I told you that was up to you. If i did that, you wouldn't have done anything. In fact, most members would probably think i've already given you too much code there.

YUP.

but to answer the OP's second question:

any loop can that can be done with a for statement, can also be done with a while statement. and vice versa. the details are different but the result will be the same.

rico.tee commented: answered my question clearly. +1
jephthah 1,888 Posting Maven

sock puppet just means an "empty head", and not implying who is in control. the emphasis is on sock; not so much on puppet.

and get used to shitty ESL grad students teaching low level programming classes. i too used to be annoyed by this, but have realized that it helps weed people out who need everything spoon-fed to them.

jephthah 1,888 Posting Maven

here's a bug: #include <conio.h> your program is worthless with that in it. why do you people insist on clinging onto that Turbo C crap?

jephthah 1,888 Posting Maven

What about posts which don't get solved or don't receive event a single reply? There have been instances of some good replies streaming in after as late as an year

...

okay, so it's the all-inclusive approach.

the rationale is that every so often someone has something useful to say, so we'll deal with 99 useless posts so we don't lose that 1 good one. i disagree with that rationale, but arguing it is now just a matter of preference.

so, that will be fine. but when i create my own online community, i'll do it differently. :P

~s.o.s~ commented: Oh, and do PM me the link if you create one ;-) +0
jonsca commented: JephthahWeb just doesn't have the same ring to it :) +0
jephthah 1,888 Posting Maven

.

jephthah 1,888 Posting Maven

this thread brings the lulz

jephthah 1,888 Posting Maven

if you want the capability of being able to shoot yourself in the foot, you can try

3. use fixed width records and one or more of "fseek", "ftell", "fsetpos", and "rewind" to manipulate the filestream and edit it in-line.


personally, though, i would go with either one of Narue's #1 or #2. manipulating inline can be fun, but ultimately is just asking for trouble.

.

jephthah 1,888 Posting Maven

i don't really know what you're talking about, but thanks for posting your solution.

someone will wander across this someday and be helped by it.

:)

jephthah 1,888 Posting Maven

M (1000) is the largest roman numeral.

Therefore, MMMDCCCLXXXVIII (3888) is the largest value that can be represented by roman numerals via standard rules.

above that value, you can use a bar over a number to indicate multiples of 1000. for instance IV with a bar over top of it equals 4 * 1000 = 4000.

this is not easy to do in ASCII, so an alternate is to put parenthesis around it: (IV) = 4 * 1000 = 4000. (CXLIV) = 144 * 1000 = 144,000, or the number of JW's who will get into heaven. the rest are apparently SOL. but i digress.

note that the romans didnt use the bar notation, this was invented in the Middle Ages. Romans just wrote out the number of M's necessary. not real convenient for scientific calculations, but since they didn't even have a zero, i don't think they really cared.

jephthah 1,888 Posting Maven

"fgets" is what you're looking for, at the very least. the easiest example will read the first line of the text file pointed by your FILE * into an arbitrary variable i call tempString:

fgets(tempString, THIRTY + 1, in)

it will read up to "THIRTY + 1" characters, or until it reaches a newline character, whichever comes first. this assumes that the entire line of the text file contains only one name entry, either first or last, but not both.

if you want to instead fill it into an array, you have to use a loop and increment the array index each time:

for (i=0; i<HOW_MANY_LOOPS; i++)
{
    fgets(studentList[i].StLastName, THIRTY + 1, in);
}

again this is making the major assumption that there is only the student's last name on each line.

the reality is that youre going to have to figure out formatting issues in your text files -- how are the names listed? do the last and first names alternate on separate lines? probably not. are teh last and first names of each student on their own line? probably. how are they separated, with just a space? or a comma? or a comma and a space?

when you have multiple elements on each line youll have to fgets the line first, then parse (separate) each element based on either fixed widths or text delimiters (like commas or whitespace). the functions "strstr" and "strtok" will be useful to parse elements based on delimiters.

jephthah 1,888 Posting Maven

what are you talking about? drawings? in C?

i mean, you can name and save any kind of file you want, whether if its a .bin or .txt or .bmp or whatever, but really, if you're drawing pictures using C, you should be well beyond asking "how do i save a file" ...

so maybe i'm not understanding what you're asking.

jephthah 1,888 Posting Maven

According to this www.DaniWeb.com is owned by NETWORK SOLUTIONS, LLC

that's the registrar, not the owner.

jephthah 1,888 Posting Maven

i'm surprised that there are people here who apparently believe any ISP is going to give two stale turds about some insignificant user trolling some random message board.

"Hello Comcast? Yes, there's this guy, you see, his name is Josh, and he's being mean on the internets.

And...?

And we want you to cancel his internet account."

O Rly?

Ya. Rly.

.

jephthah 1,888 Posting Maven

i disagree. for the context of an internet forum, three months is plenty of time to get meaningful responses.

every time that I've seen an old post revisited, it's just some variant on "ME TOO". it's really a waste of time and space. i personally hate reading a thread only to find afterward that it's three years old.

jephthah 1,888 Posting Maven

Just because some dullard abuses a system that does not mean that the the system itself is bad, nor does it mean that the dullard is some kind of hero - it just means that someone has abused the system and as soon as we find out who it is (and Dani is now on the case, tracking them down) they can look forward to being banned from DaniWeb.

if your "system" requires constant vigilance from a team of lifeguards monitoring for people peeing in the pool, and manually booting them out every time another one does it, then that system is broken.

.

jephthah 1,888 Posting Maven

why not save everyone the hassle and FORCE CLOSE all threads with >3 months of inactivity.

jephthah 1,888 Posting Maven

this is not a random bot or whatnot. someone is purposely targeting these people. i think it's obvious that they are doing so in order to highlight the absurdity of the arbitrary and anonymous voting system.

any skript kiddie can write a couple dozen lines of perl code to parse thru "user x" post history and downvote every single post. i could do it if i cared to. i don't do it because it's not my thing.

the point here, is that the whole up/down voting system -- as it is architected -- is broken at the most fundamental level.

to have any generic user be able to arbitrarily and anonymously alter another members permanent record -- even if "it doesn't really mean anything" -- is just asking for trouble. it's putting a big sign up inviting everyone to try and exploit the system.

Salem commented: Well said +0
Nick Evan commented: You appear to be right +0
Grn Xtrm commented: agreed +0
VernonDozier commented: Agree. Broken at the most fundamental level. +0
jephthah 1,888 Posting Maven

she's not supposed to be gone so long.

i miss getting beat up by her.

:(

jephthah 1,888 Posting Maven

i had some dude i knew from the coffee shop always trying to push his Book of Urantia on me. he was weird. i finally took the book, and looked at it one night. it was about as batshit loony as the Book of Mormon.

jephthah 1,888 Posting Maven

you've got a lot of issues. for instance, these lines:

mino - minn = 30;
mino - minn = 60;
mino - minn = 00;

you can't make assignments like that. i'm having a really hard time following your logic, but you need to have the one variable being assigned on the LHS and the expression it gets assigned to on the RHS. like: mino = minn + 30 .

another thing is you have "car" as a type char (single character) then you later try to assign it the value 1.5. that's not going to work at all. you can only assign it char values, like: car = 'c'; or car = 'T'; or car = 0x63; // ascii for 'c' or car = 0x54; // ascii for 'T' there are other problems but i'm going to stop now

jephthah 1,888 Posting Maven

Dear colleagues I am currently working on _________ using Borland C.

with all the solid professional compilers and dev environments out there -- many of them absolutely free -- why anyone, anywhere still uses this pile of non-standard crap of a compiler, is beyond me.

it truly hurts my soul.


EDIT: and as A.D. pointed out, this is exceedingly complex. using buggy, non-standard, unportable Borland, you are just asking for even more trouble.

.

Aia commented: Good answer, spiced with passion. +7
jephthah 1,888 Posting Maven

I'd bring Dani, the cscgal.

jephthah 1,888 Posting Maven

. You might want to try turning off the firewall for a couple of minutes and then see if you can observe the same behavior

don't do it.

it's a trap.

Nick Evan commented: The cake is a lie.. +0
Ezzaral commented: shhhhhh... quit scaring them off. +0
nav33n commented: I don't remember asking you a goddamn thing! :P +0
jephthah 1,888 Posting Maven

is it just me, or does kaninelupus always seem to be the guy shouting "me-too" every time the attention is directed away from him?

jephthah 1,888 Posting Maven

do u have any solution/code at present on this issue.. plz share with me ..

hi, NAIK.

did you try this?

jephthah 1,888 Posting Maven

i really want to help you, but your code is painful to look at. please repost it and enclose your code within [code] [/code] tags.

always use good coding practice like proper indention of code blocks, and do not put line numbers in front of each line, it only serves to make it less readable.

jephthah 1,888 Posting Maven

i think i'm going to go visit all of Bob's prior posts and upvote them all.

diafol commented: Back at you! Obviously p*ssed you off. Get a mod badge and stop licking brown.. +0
jephthah 1,888 Posting Maven

i am astounded at the level of credulity evident in this thread.

jephthah 1,888 Posting Maven

mean old u.s. always hiding the goods from the rest of the world.

you should meditate on over to the other side of the universe and bring back some super duper ubar technology.

that'll show 'em.

jephthah 1,888 Posting Maven

looking at the answers you have given to others


-- "Shut down your PC for 30 minutes every 4 hours"

-- "Save every 20 minutes when playing on-line games"

-- "You could have a miss-match or RAM"


it's obvious that bob is right: you dont know what you're talking about.

i would have told you the same thing.

jephthah 1,888 Posting Maven

that video is awesome. i cant see it here at work, but i hope you linked the one with the cool musical score.

i'm pretty certain he's not (just) drunk though. probably high on pure ether, or perhaps ketamine (special K)

jephthah 1,888 Posting Maven

if you would like to get a meaningful response, please consider the following:

How to Ask a Question

Please Use Code Tags

jephthah 1,888 Posting Maven

i don't know what you're talking about, and i'm certainly not going to email you anything.

jephthah 1,888 Posting Maven

you can't do this:

if (ch == *my_word ||*my_word2 || *my_word3)

you have to specify what you're testing for each OR'ed condition.

if (ch == *my_word || ch == *my_word2 || ch == *my_word3)
jephthah 1,888 Posting Maven

Hi, tgir.

lets see if we can help. I believe your question is how to access 3x3 two-dimensional array. does that sound accurate?

also, i'm just curious, what engineering school do you go to?

--j

jephthah 1,888 Posting Maven

you need to post a question if you want an answer.

jephthah 1,888 Posting Maven

and quit assuming everyone on here is a "sir". sexist language was deprecated last century. get with the program.

jephthah 1,888 Posting Maven

when you 'getch' you're taking the next character off of the input queue for processing.

this assumes once you've processed it, you're done with it, and will (probably) eventually want to get another character off the input queue.

'ungetch' puts that input back on the input queue.

this effectively allows you to "peek" at the input queue and know what the next character is without destroying it, so that it can be used again at some other point.

jephthah 1,888 Posting Maven

no one's going to give you complete code for anything.

but here's a snippet:

while(1)
{
    // do stuff here
}

cheers!

jephthah 1,888 Posting Maven

i think your changes are inspired by a lot of good ideas :)

but like some other i also think it has added the perception of too much clutter.

i think the most grievous offender is the row of "share this" "send that" "bookmark" "yadda yadda" buttons... I think they're ugly and extremely distracting/annoying. i would get rid of all that, because i never use any of that stuff. i think it would go a long way to cleaning up the clutter.

also, the arrow design for the up/down voting... the voting concept is cool, and i think will improve the site, but the arrow buttons are just ugly and stick out like a sore thumb. perhaps something more discrete, like small unobtrusive thumbs-up thumbs-down icons ... and also perhaps making the numeric for the up/down vote count a bit less prominent.

finally, I'm not happy that my rep power went to only +5. Maybe i would like it better if i could understand how the new rep-altering formula is calculated.

that's my $0.02

jephthah 1,888 Posting Maven

5 seconds? well, excuse me if i don't fall all over myself with enthusiasm.

they should make it indefinite, that you can recall any email at any time, so long as someone hasnt already accessed it.

jephthah 1,888 Posting Maven

this is a lie.

hardcore gamerz are way too 1337 to ever fall for a trick like that.

jephthah 1,888 Posting Maven

yeah. and if it takes one woman 9 months to grow a baby, it should take 9 women...

oh never mind.

here's what every linux geek out there should do.

partition your work computer's hard drive, and dual boot your favorite linux OS on the new part.

then use it for all tasks you can get away with.

eventually it will catch on. for every high level exec who buys into the whole TCO argument, there will be one who says "FREE? hell yeah, lets get-r-dun!"

it will spread. not like a wildfire perhaps... but maybe more like kudzu.

jephthah 1,888 Posting Maven

converse with him

now see, this is how i know this is bulls---. you got a bunch of star-trek-watching computer AI tech geeks working on creating an artificial humanoid in a sort of "holodeck" environment...

... and it's gonna be a HE???

i'm callin' shenanigans.

jephthah 1,888 Posting Maven

your random dice aren't random.

jephthah 1,888 Posting Maven

A+++++ quality snippet would read this poster again.

jephthah 1,888 Posting Maven

wow, dude, this snippet rocks! A+++ would read again!

jephthah 1,888 Posting Maven

too many new and intermediate users of C attempt to use the command fflush(stdin) to "flush the input buffer". this is patently wrong.

the rule is (and click if you don't believe me) : NEVER USE "FFLUSH()" ON INPUT STREAMS SUCH AS "STDIN"

here is one method of properly flushing extra (and unwanted) characters from the stdin input stream. the code is written as a macro, and requires a character array to collect excess (junk) input. the macro will also ensure the newline character is stripped.

the intended use is in conjunction with fgets. for example:

char userInput[8]; // change array size to any arbitrary value

    printf("input a string and hit <enter>.  A maximum of %d characters will be recorded.\n",sizeof(userInput)-1);

    fgets(userInput,sizeof(userInput),stdin);
    FLUSH_STDIN(userInput);    // strip newline, flush extra chars

    printf("the first %d characters are \"%s\", any others have been discarded.\n",strlen(userInput),userInput);
jephthah 1,888 Posting Maven

is this C or C++?

i say C-