1,265 Posted Topics
Re: first function depends on second. caller is responsible for error-checking input into "convert( )" example : value = convert("mcmlxix"); returns: value = 1969 [code=c] int convert(char *roman) { int arabic = 0, tmp; char *str_p = roman; while(*str_p) { tmp = letterValue(*str_p); if (letterValue(*++str_p) > tmp) arabic -= tmp; else … | |
Re: insert your properly-indented code between code tags [ code=c ] insert code here [ /code ] (except, do not have any spaces within tag brackets... i just put those there so it wouldn't actually turn it into "code" ...) | |
okay, experts, i need help. i can't seem to replace characters in a file, like i thought i would be able to: here's an example code. i put print and error stuff in there to try and debug. everything seems to be working ... except that my filename is not … | |
Re: man, you're gonna have to come off with a better description than that. lets see your code, and we'll go from there. | |
Re: just be careful you dont let the smoke out of your video card. that stuff's hard to put back in. | |
Re: [code=c] #include <stdio.h> main() { int value; printf("enter any decimal value: "); scanf("%d",&value); printf("value: decimal %d = hex %x\n", value, value); return 0; }[/code] thats all you have to do, right? "int" doesnt have an inherent base. it's whatever you want it to be, whenever you want it to be. … | |
Re: you could consider using \W+ instead of \/ and \: \W+ is any amount of non-alphanumerics. as opposed to \w+ which is any amount of alphanumerics (ie, 'A-Z' plus 'a-z' plus '0-9' plus '_' ) that way you wont be locked into certain exact type and amount of separators between … | |
Re: Bio Perl... that looks like some pretty cool stuff now i have a new diversion to poke around in :) | |
Re: Thank the gods. Someone finally answered this question that we've all been struggling with this for 4 1/2 long years, what a relief. someone let Tim know he can mark this as "solved" | |
Re: there's no such thing as a random number. num = rand(); will return a [b]"pseudo-random"[/b] number over the interval between 0 and 2^32, depending on your compiler. not truly random, but i suspect that it will have enough "appearance" of being random for your purposes. | |
Re: why the f would anyone think this is a reasonable question for a programming class? no wonder so many people come out of CSC 101 or whatever hating programming, and not knowing how to do a damn thing. | |
Re: friends don't let friends use AOL not because of hacking. just because | |
Re: maybe these people are all from countries that blacklist Google's IPs just wondering. | |
Re: just because you include the header file doesn't mean you're getting the code. the errors you described earlier sound like you're not linking properly. the solution depends on your compiler, and how their source code is provided... whether it's in a .dll or a .lib or whatever | |
Re: uh, did you try this? [code] C:\> copy file.txt C:\path\to\new\place\ C:\> cd C:\path\to\new\place C:\path\to\new\place> type file.txt [/code] | |
Re: solutions involve using either #include <conio.h> or #include <windows.h> neither of which are portable. for Linux/Solaris, you would use the #include <ncurses.h> library [url]http://www.blurtit.com/q616731.html[/url] [url]http://www.daniweb.com/forums/thread34554.html[/url] [url]http://www.unix.com/high-level-programming/33023-blinking-text.html[/url] | |
Re: at least some of your problem may be due to fgets( ) retains the newline character. but im not sure how some of the other stuff you're doing would work... anyhow, I think you'll find it's best to try to keep code basic and readable for the next guy, rather … | |
Re: well... the first 5 lines are okay... on line 5 you fget the first line of the file and put it into the string "line"... that's fine too but then on line 7, you start checking the string "readline" where does this come from? you should be checking the string … | |
Re: [quote]can some one make this before 19 march 2008. it is my homework [/quote] LOL you kids, i swear how about you send me $500 to my PayPal account and I'll won't track your IP address and tell your teacher what you're up to.. | |
Re: how about you take a stab at it, and when it doesnt work you post what you did here, then we can look and see where the error(s) might be. | |
Re: your post is the surest way to not get any help here. if you want help, here are the steps you must follow: (1) write part of your program (2) when it doesn't work, post your code and specific questions here | |
Re: [QUOTE=arpit_yadav;564312]I have seen your problem & itry to solv it out .[/quote] i seriously doubt that. [quote]please help me to rite a sample TSR[/QUOTE] how about if i sign your address up with every contact on the ROKSO blacklist, just for being a rude thread hijacker. start your own thread. … | |
Re: at the very least, you have to have an equal number of open parentheses and close parentheses '(' and ')' in any given statement. and if youre going to have a conditional after "else", then it needs to be "else if" ... which then presumes another statement to follow for … | |
Re: for the love of all that is good and holy, please remove those foul GOTO statements. the answer is easy enough, but i cant even bear to look at this code as long as there's a GOTO in there. | |
Re: change it to this: [code] server_addr.sin_family = AF_INET; server_addr.sin_addr.s_addr = inet_aton(IP); server_addr.sin_port = htons(PORT); [/code] | |
Re: [QUOTE=severman;563077]ive tried and tried and still nothing. i just dont get it. how do i copy the line in my struct and copy it as a string...[/QUOTE] okay, here's your structure [code=c]# typedef struct { int id; char full_name[LEN]; struct { unsigned sem_a; unsigned sem_b; }grades; }Student; [/code] so you … | |
Re: If a train leaves the station @ 8:30 p.m. full of clowns named bob and larry and one named steve and it takes 1 hour to get there, the number of licks it will take to get to the center of a tootsie roll tootsie pop = 42. QED. | |
Re: wow. now THAT was one helluva gift, serverdude. you don't even know. | |
Re: [QUOTE]Currently I'm working like this: gtsee.com/cgi-bin... [/QUOTE] whoa, for a sec i thought you were pointing us to the goatse dude :O | |
Re: [QUOTE]so the same commands will work on both linux and windows ?[/QUOTE] rarely, if ever, does windows and linux have the same commands for anything. for compiling C on windows, you might typically use the MSVC compiler distributed for free from Microsoft, either as a standalone or as part of … | |
Re: I would try to help you but your code is unreadable. You need to use the "code" tags and include your indentations as described in the posting rules. also, you need to explain what you have already done as far as debugging. like Kevin said, this is not a service … | |
Re: you can make it a function: [code=c] void strToUppercase(char * myString) { while(*myString) *myString = toupper(*myString++) } [/code] or perhaps a more "easy to understand" bit of inline code: [code=c] char myString[128]; strcpy(myString,"the quick brown fox jumped over the lazy dogs"); for(a = 0; a<strlen(myString); a++) { if (myString[a] >= … | |
Re: never use conio.h for anything. that just breaks your program for anythign other than windows. and never,.ever, ever use "GOTO" statements. and by that i mean never. they're absolutely horrid. use a while or for loop instead. | |
Re: giving new programmers "malloc" is like giving them rope to hang themselves with or a gun to shoot themselves in the foot with. even experienced programmers should avoid the use of malloc unless absolutely necessary. which it usually isn't. declare the local "tmp" string in the subroutine as a char … | |
Re: strtok will work to be sure, but you have to watch out that it will stomp all over your original string. another way is to use pointers. make sure you can understand, and explain, how this works [code=c] void capitalizeFirsts(char *buf) { *buf=toupper(*buf); // first char CAP while (*buf++ != … | |
Re: [QUOTE=os.hacker64;560244]How does gcc order bitfields on a little-endian machine? Is the first entry the most significant bit or what?[/QUOTE] endianness referrs to byte ordering, not bits. bit ordering is always the same. endianness describes the direction that bytes are stored in increasing memory locations. big-endian means "big end first". little-endian … | |
Re: this is a tough problem. i actually tried to do this last night, and i could not get it to work right. getch() from the <curses.h> library, did not work as advertised for me. and im using the gcc compiler. obviously the getchar( ) function requires an <ENTER> before reading … | |
Re: printf, as narue said, is able to format quite well. [code=c] sumValue = firstValue + secondValue; printf(" 0x%04X\n", firstValue); printf("+ 0x%04X\n", secondValue); printf(" --------\n"); printf(" 0x%04X\n", sumValue); [/code] i think we can just this one away for free. | |
Re: compile the following program, run it, and print the results back here [code=c] #include <stdio.h> int main() { printf("sizeof(char) == %d\n", sizeof(char)); printf("sizeof(short) == %d\n", sizeof(short)); printf("sizeof(int) == %d\n", sizeof(int)); printf("sizeof(long) == %d\n", sizeof(long)); printf("sizeof(long long) == %d\n", sizeof(long long)); return 0; } [/code] this will show you that 12! … | |
Re: "I created a text box ..."' you created a GUI and you're trying to get the input to a file handle? | |
Re: god forbid someone ask a legitimate question here without getting told to RTFM. i see now how Walt has so many 'solved' threads. one problem is youre putting your filenames in quotes. otherwise, its pretty simple, just use "fopen" and "fgets" in a this manner. [code=c] printf("enter filename: "); fgets(filename, … | |
Re: spec80, ignore walt. He's apparently got some hostility issues with people who have honest questions. nice quality for a moderator. anyhow, don't panic. you're 99% done. instead of locally calling "rootone" and "roottwo" inside your subroutine, use the global variables that you already declared outside of main() ... "root1" and … | |
Re: youre crazy if you think anyone is going to try and read that mess. you need to formulate some kind of a coherent question about what you're trying to do with this guy's code. | |
Re: [U]heres how this works:[/U] FIRST, you write your program, or at least part of your program. THEN, when it doesn't work, you come here and ask why doesn't such-and-such work, and show what you were trying to do. FINALLY, we will show you how to fix it and make it … | |
Re: well, i'm sure glad you told us it was for "academic purposes". i was getting ready to call Chris Hansen |
The End.