• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 11:09
CEST 17:09
KST 00:09
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro16 Preview Pt1: Fresh Flow6[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy21ByuL: The Forgotten Master of ZvT30
Community News
MaNa leaves Team Liquid14$5,000 WardiTV TLMC tournament - Presented by Monster Energy5GSL CK: More events planned pending crowdfunding7Weekly Cups (May 30-Apr 5): herO, Clem, SHIN win0[BSL22] RO32 Group Stage5
StarCraft 2
General
Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool MaNa leaves Team Liquid Team Liquid Map Contest #22 - Presented by Monster Energy Quebec Clan still alive ? BGE Stara Zagora 2026 cancelled
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament $5,000 WardiTV TLMC tournament - Presented by Monster Energy RSL Revival: Season 5 - Qualifiers and Main Event GSL CK: More events planned pending crowdfunding Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 521 Memorable Boss The PondCast: SC2 News & Results Mutation # 520 Moving Fees Mutation # 519 Inner Power
Brood War
General
[ASL21] Ro16 Preview Pt1: Fresh Flow Leta's ASL Ro24 Review The Korean Terminology Thread ASL21 General Discussion BGH Auto Balance -> http://bghmmr.eu/
Tourneys
Escore Tournament StarCraft Season 2 [ASL21] Ro16 Group A [Megathread] Daily Proleagues [ASL21] Ro24 Group F
Strategy
Any training maps people recommend? Fighting Spirit mining rates Muta micro map competition What's the deal with APM & what's its true value
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Battle Aces/David Kim RTS Megathread General RTS Discussion Thread Starcraft Tabletop Miniature Game
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Canadian Politics Mega-thread Russo-Ukrainian War Thread European Politico-economics QA Mega-thread The China Politics Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
lurker extra damage testi…
StaticNine
How Streamers Inspire Gamers…
TrAiDoS
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1853 users

The Big Programming Thread - Page 851

Forum Index > General Forum
Post a Reply
Prev 1 849 850 851 852 853 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Deleted User 173346
Profile Blog Joined April 2011
16169 Posts
February 23 2017 07:29 GMT
#17001
--- Nuked ---
Manit0u
Profile Blog Joined August 2004
Poland17720 Posts
February 23 2017 09:25 GMT
#17002
On February 23 2017 14:14 plasmidghost wrote:
(Hope this is allowed) I'll give someone an up to $10 Steam game of their choice if they can help me get my C programs working since it's not really fair of me to ask for someone to help me with code this complex for free


This code is not very complex...
Time is precious. Waste it wisely.
Acrofales
Profile Joined August 2010
Spain18259 Posts
February 23 2017 09:36 GMT
#17003
On February 23 2017 18:25 Manit0u wrote:
Show nested quote +
On February 23 2017 14:14 plasmidghost wrote:
(Hope this is allowed) I'll give someone an up to $10 Steam game of their choice if they can help me get my C programs working since it's not really fair of me to ask for someone to help me with code this complex for free


This code is not very complex...

So take the $10 and laugh your way to the bank
waffelz
Profile Blog Joined June 2012
Germany711 Posts
February 23 2017 13:34 GMT
#17004
LOL:
[image loading]
RIP "The big travis CS degree thread", taken from us too soon | Honourable forum princess, defended by Rebs-approved white knights
tofucake
Profile Blog Joined October 2009
Hyrule19202 Posts
February 23 2017 13:43 GMT
#17005
and yet travis has been following the rules very well for a long time :D
Liquipediaasante sana squash banana
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-02-23 14:28:52
February 23 2017 14:25 GMT
#17006
I am very confused about the differences of empty strings in C

so, a string is a character array.

A string pointer points to an index of that array, and the string is all the indexes that have characters until the null character

the null character is '\0'

a string that is a character array where index 0 is '\0' is an empty string, which is not the same as the string being null (uninitialized)

and then... what is happening when you say String = '' (these are single quotes with nothing inbetween).

If someone passed my method a string of 2 empty quotes with nothing inbetween, how do I check for that?
I seem to be able to pass it into my program, and have no way to check for it. If I try to simply check for '', the compiler gives me an error about an empty character constant

also please correct any inaccuracies/misconceptions I have about strings


thank you!
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2017-02-23 15:08:06
February 23 2017 14:59 GMT
#17007
--- Nuked ---
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
February 23 2017 15:08 GMT
#17008
On February 23 2017 23:59 Nesserev wrote:
There is no empty character constant. So, you get an error, because the compiler recognizes that this isn't a valid token.


Well, I have an assignment where I pass in a character array and it centers the character array(string) between a specified number of spaces

I pass in '' (empty character), and my program behaves very strangely. So I was wondering how to look for that.

i guess as far as user input goes there would be no way for a user to input an empty character so there is no point in worrying about it?
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2017-02-23 15:54:16
February 23 2017 15:10 GMT
#17009
--- Nuked ---
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
February 23 2017 15:25 GMT
#17010
oh, so the characters you are passing are \ and ' ?

So, to check for it, I would literally check for '\'' ?
Acrofales
Profile Joined August 2010
Spain18259 Posts
Last Edited: 2017-02-23 16:43:03
February 23 2017 16:42 GMT
#17011
On February 24 2017 00:25 travis wrote:
oh, so the characters you are passing are \ and ' ?

So, to check for it, I would literally check for '\'' ?

No. You're misunderstanding how characters work. The character that you are passing is
'
. However, you are inputting this from the command line (I presume) using scanf or something similar? If so, anything you input there is already escaped. If you need to write it in your source code, you would need to escape that character yourself, and thus you would write:

char apostrophe = '\'';

These are not two chars. It is one single char (apostrophe), but because ' itself has a very specific meaning in C code, you need to escape it when you want it to be seen as that char, and not as meaning something to the compiler (specifically, the opening or closing of a char). The same goes for any other special character, such as #, " or \ itself.

Empty char is not defined. So if you try to write:

char apostrophe = '';

you should get a compiler error (or rather, a parser error, but forget about that distinction).

Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-02-23 19:41:51
February 23 2017 19:34 GMT
#17012
edit:

fixed mah problems
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2017-02-24 04:28:12
February 24 2017 04:27 GMT
#17013
On February 23 2017 16:29 plasmidghost wrote:
Show nested quote +
On February 23 2017 16:27 Blisse wrote:
On February 23 2017 13:14 plasmidghost wrote:
Regarding my code, I've noticed a few things:
No matter the input, my variables to check for invalid characters/vowel number always goes to 9, meaning my if else statements in my server code are bad
The client only receives the string from the server if there are any uppercase letters


idk if you read my editted comment but there are a few errors

you do = 9 instead of == 9 which sets the value instead of comparing them

you do c == 'a' || 'e' || 'i' which checks if char is equal to 'a', then if 'e' > 0 which is true, and if 'i' > 0 which is true, and etc.


you should really use functions to eliminate duplicate code

bool is_vowel(char c) {
return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
}

Oh, sorry, I didn't even see that you had edited in more information, thank you for the help


I wanted to try this because I didn't take the class but I watched my friends struggle with a similar assignment which looked cool.

Unfortunately compiles but completely untested because Windows Bash doesn't support mkfifo, but this should give an idea of clearer code.

There's a couple mistakes like where I use data.value instead of buffer, and probably using the string functions incorrectly. Also changed from 10 to 6 with a variable but didn't correct in all places cos can't run lol

http://pastebin.com/8qCh1063
There is no one like you in the universe.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
February 24 2017 04:40 GMT
#17014
On February 23 2017 15:37 Nesserev wrote:
Show nested quote +
On February 23 2017 15:07 WarSame wrote:
Today I found out that if you are local hosting something it is apparently visible to everyone on your LAN, which is very exciting news for me! My friend came over and I taught him some programming for a few hours and he asked a fair number of questions that had never crossed my mind. That was one of them.

Uh, that shouldn't happen by default though.

Usually what you have to do is:
- specify which network interface(s) to listen behind
- change your firewall settings
- find out your local IP address

Some web servers seem to just listen on all available network interfaces by default... which isn't a good thing. Using 'localhost' as the default network interface, and being explicit about other network interfaces is much more secure.

Also, did you have your firewall set up?

My firewall is definitely set up. I'm not 100% sure what a network interface is, but my friend did have to enter my "IP"(not an actual IP) on my LAN, so that may be what you mean. We also had to allow the connection through our firewalls, IIRC when we were first setting up the server. And yeah, we found our local IP address by ipconfig, so he'd type in "http://192.168.0.16:3000" to access my server on port 3000.

Could you clarify what a network interface is? Google isn't really making sense to me.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2017-02-24 07:15:46
February 24 2017 07:01 GMT
#17015
--- Nuked ---
meatpudding
Profile Joined March 2011
Australia520 Posts
Last Edited: 2017-02-24 09:58:31
February 24 2017 09:55 GMT
#17016
On February 23 2017 10:57 plasmidghost wrote:
Show nested quote +
On February 23 2017 10:46 Blisse wrote:
For one, your scanf 6 times gets 6 letters, q, \n, w, \n, e, \n

Need scanf(" %c", ..) with the extra space

Secondly l, m and n are allocated as size 1 arrays for some erason, but you access the second element by l[1], which is invalid. l[0] is what you want, or really just not using an array type here

With that specific output I was just testing to see if it would take enter keystrokes as characters
I replaced all the size one arrays to just be an int as well as changing my for loops for accepting characters to be fgets statements and it now partially works
[image loading]
Current server code: pastebin.com
Current client code: pastebin.com


Just having a quick look...

This seems to be a huge problem
if(inst.outchar1[i] < 'a' && inst.outchar1[i] > 'z')


Edit:

Also this
else if(inst.outchar1[i] = 'a' || 'e' || 'i' || 'o' || 'u')

Shoulde lok more like this
else if(inst.outchar1[i] == 'a' || inst.outchar1[i] == 'e' || inst.outchar1[i] == 'i' || inst.outchar1[i] == 'o' || inst.outchar1[i] == 'u')

Note the = is the assignment operator and == is the equality operator. Each individual statement will be assessed, so you are asking "is this equal" OR "is 'e' true/nonzero" etc.
Be excellent to each other.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-02-24 20:03:58
February 24 2017 19:48 GMT
#17017
edit: everything in spoiler can be ignored.
the problem is that I decremented my paragraph_number by one in one of my functions, but not the other

in other news, this class is insane. this workload is actually just crazy

+ Show Spoiler +

working on a project, having some woes

this is way harder than java was

I can't post my code but maybe I can describe it and someone will have an idea what is going on

I have document structures, which contain an array of paragraph structures. Paragraphs hold paragraph 2 dimensional arrays. These arrays are "lines" where each line is a string.

In each paragraph structure, there is a variable that holds the amount of lines in that paragraph, and I increment it when I add lines.

Now, I have a function

int add_line_after(Document * doc, int paragraph_number, int line_number,
const char *new_line) {


You add a line at that line number, in that paragraph, where the text is *new_line.
This function seems to work fine.

I have another function


int append_line(Document *doc, int paragraph_number, const char *new_line) {


this function adds *new_line text as a new line at the END of the lines of that paragraph.

To implement this, I start with


line_number = doc->paragraphs[paragraph_number].number_of_lines


My intention is to pass line_number to the first method (add_line_after), because it inserts the line at whatever line number you say, and this line number should be the last line. (0, then 1, then 2, etc)

Now here is the part I don't understand. It's not working. It's not working because it's saying that the line number is 0 every time. I am checking with a print statement.

But I also have a print statement to check the line number value in my add_line_after function. And in *THAT* function, it is incrementing the line number each time. It says (0, then 1, then 2, etc).

If I try to do append_line 3 times my print statements say "010203"

But they are both printing the value ofthe same variable.. right? or not?
god does this have something to do with C's pass by value bullshit and I am not using pointers correctly? this is so complicated

I really thought doc->paragraphs[paragraph_number].number_of_lines would be pointing to the same thing each time

can you guys heeeeeeeeelp me

Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2017-02-24 20:54:31
February 24 2017 20:53 GMT
#17018
Also in other news, words cannot describe how much I'm disgusted by indie developers.

Been meaning to do foobar2000 development for a while, but never got into it because of the high barrier to entry, so I finally sat down yesterday to plow through getting a build to... build. So many Visual Studio issues to work through, like hardcoded library paths, hardcoded build scripts, missing libs... and the code quality is also so poor. Like seriously, single 3000-line file. the nice part is refactoring stuff will help me learn what's what.
There is no one like you in the universe.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-02-24 21:26:10
February 24 2017 21:15 GMT
#17019
there has been like 20 times today ive typed stuff out into this submit form and then erased it because I figured out my problem as I was typing it

you guys *are* my rubber ducky

also how do C developers not go crazy staring at this shit
emperorchampion
Profile Blog Joined December 2008
Canada9496 Posts
February 24 2017 21:56 GMT
#17020
On February 25 2017 06:15 travis wrote:
there has been like 20 times today ive typed stuff out into this submit form and then erased it because I figured out my problem as I was typing it

you guys *are* my rubber ducky

also how do C developers not go crazy staring at this shit

That's the secret, they're all crazy
TRUEESPORTS || your days as a respected member of team liquid are over
Prev 1 849 850 851 852 853 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 52m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
LamboSC2 290
Hui .286
Lowko281
ProTech127
StarCraft: Brood War
Sea 12986
Calm 7234
Bisu 3943
Horang2 2124
Jaedong 1600
Mini 611
EffOrt 522
BeSt 464
Stork 440
firebathero 397
[ Show more ]
Larva 242
Soulkey 167
Hyun 156
Zeus 148
Rush 135
actioN 133
Pusan 110
ggaemo 68
Dewaltoss 66
[sc1f]eonzerg 63
ToSsGirL 50
Mind 50
Killer 47
zelot 37
Barracks 29
Nal_rA 27
Rock 20
Movie 17
Terrorterran 15
Hm[arnc] 15
GoRush 15
IntoTheRainbow 11
SilentControl 11
Bale 10
Sexy 7
Dota 2
qojqva1945
syndereN279
420jenkins184
League of Legends
Reynor20
Counter-Strike
fl0m4522
olofmeister4293
Other Games
hiko953
B2W.Neo947
XBOCT340
crisheroes299
Pyrionflax173
KnowMe120
RotterdaM91
QueenE85
ArmadaUGS58
Mew2King36
Trikslyr20
Organizations
Other Games
WardiTV721
BasetradeTV497
Counter-Strike
PGL246
StarCraft: Brood War
Kim Chul Min (afreeca) 17
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• StrangeGG 67
• Shameless 2
• IndyKCrew
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• LaughNgamezSOOP
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• Noizen47
League of Legends
• Nemesis2080
• TFBlade1396
• Jankos659
Other Games
• Shiphtur27
Upcoming Events
Monday Night Weeklies
52m
OSC
8h 52m
Afreeca Starleague
18h 52m
Snow vs PianO
hero vs Rain
WardiTV Map Contest Tou…
18h 52m
GSL
20h 52m
PiGosaur Cup
1d 8h
CranKy Ducklings
1d 17h
Kung Fu Cup
1d 20h
Replay Cast
2 days
The PondCast
2 days
[ Show More ]
WardiTV Map Contest Tou…
2 days
Replay Cast
3 days
Escore
3 days
WardiTV Map Contest Tou…
3 days
Korean StarCraft League
4 days
CranKy Ducklings
4 days
WardiTV Map Contest Tou…
4 days
IPSL
5 days
WolFix vs nOmaD
dxtr13 vs Razz
BSL
5 days
Sparkling Tuna Cup
5 days
WardiTV Map Contest Tou…
5 days
Ladder Legends
5 days
BSL
6 days
IPSL
6 days
JDConan vs TBD
Aegong vs rasowy
Replay Cast
6 days
Replay Cast
6 days
Wardi Open
6 days
Afreeca Starleague
6 days
Bisu vs Ample
Jaedong vs Flash
Liquipedia Results

Completed

Escore Tournament S2: W2
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
StarCraft2 Community Team League 2026 Spring
Nations Cup 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

Escore Tournament S2: W3
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
RSL Revival: Season 5
WardiTV TLMC #16
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.