15,550 Topics

Member Avatar for
Member Avatar for Stpdoug

I have a small problem why is this code not writting information into the userdata.txt file? I am not getting any errors in code blocks it runs but the file does not get any data. While in visual c++ the code gives me "debug assertion failed...expression: str(!=NUll)". What am i …

Member Avatar for Stpdoug
0
208
Member Avatar for mical700

C program that extends my.c to take file names as command line arguments. It will read each named file and write the first 10 lines to standard output. If there are no command line arguments, it will read from standard input. If "-" is given as a file name, it …

Member Avatar for mical700
0
146
Member Avatar for saurabh.mehta.33234

main() { union u { struct s{int a;int b}n; struct ss{int c;long d}ni; }uu; uu.ni.c=1; uu.ni.d=0; printf("%d %d",(uu.n.a),(uu.n.b)); } output: 1 32767 Now my question is that even though I put d=0 then why does it shows 32767 as output for b?As per my knowledge union members share the same …

Member Avatar for saurabh.mehta.33234
-1
123
Member Avatar for mical700

How to convert C++ code to C. Write a program in C that asks a user for the name of a file. The program should display the first 10 lines of the file on the screen (the "head" of the file). If the file has fewer than 10 lines, the …

Member Avatar for deceptikon
0
1K
Member Avatar for otengkwaku

Hi guys i know that in linux you create a c file and use make or gcc or clang to compile it and then run it. My question is how do you run a c file or c++ file in vs2012 with out creating a solution. Also how do you …

Member Avatar for otengkwaku
0
331
Member Avatar for BWASS

I want to read a datafile which consits of 5 coloums and 4 rows, which consists of numbers seperated by commas. The first line of the data file looks like this: 103343, 24, 55, 24,12. I have started my program by allowing to input the file in my program, however …

Member Avatar for deceptikon
0
103
Member Avatar for Learningvinit

When we pass arg which is of type va_list as a parameter to a different function which calls vsprintf and vfprint giving one of the parameter as args, It gives core dump. But when we make a copy (i.e va_copy) and pass copy to one of vsprintf or vfprintf and …

Member Avatar for L7Sqr
0
539
Member Avatar for saurabh.mehta.33234

I came across the foll code: #include<stdio.h> main() { int i=4,j=7; j=j||(printf("you can")&&(i=5)); printf("%d %d",i,j); } output: 4 1 Athough I am specifying the braces for the && operator so that it gets executed first..Then also the value of i remains 4 only..Why doesnot it gets changed to 5??Also the …

Member Avatar for Banfa
-1
229
Member Avatar for SoulofchaOs

After I clicked the 'Run' button in Netbeans, it will compile and run and then it will stop at this point : [Click Here](http://i.imgur.com/4O8vY2d.png) I will have to press any key on the keyboard then it will display the text, but it doesn't allow the user to enter any form …

Member Avatar for tinstaafl
0
223
Member Avatar for noble3ad

Hello all, I'm suppose to write a program that asks the user to input five numbers. Out of those five numbers, the program is suppose to select the maximum value. I attempted to do it with "else-if" statements as can be seen in the following code. I was hoping there …

Member Avatar for arunkumar4003
0
431
Member Avatar for smith32

Hi, Here is the File content. I want to use strtok to separate each. but the problem is if i use `strtok(string, "\",");`, the zip code (19428) of the detail is miss place and take State (PA) for the first record Because of "," in State. Although the second one …

Member Avatar for smith32
0
1K
Member Avatar for tyler.dahle

if(kbhit()){ getch(); if(getch() == ' '){ while(y9 < 770){ readimagefile("PIX\\thunderball\\thunderball.gif", x9+10, y9+40, x9+40, y9+70);Sleep(80); putimage(0, 0, background, COPY_PUT); readimagefile("PIX\\thunderball\\thunderball2.gif", x9+10, y9+40, x9+40, y9+70);Sleep(80); putimage(0, 0, background, COPY_PUT); readimagefile("PIX\\thunderball\\thunderball3.gif", x9+10, y9+40, x9+40, y9+70);Sleep(80); putimage(0, 0, background, COPY_PUT); y9++;}} if(y9 == 730){ readimagefile("PIX\\thunderball\\thunderball_contact.gif", x9, y9, x9+30, y9+30);Sleep(80); putimage(0, 0, background, COPY_PUT); readimagefile("PIX\\thunderball\\thunderball_contact2.gif", …

Member Avatar for tyler.dahle
0
196
Member Avatar for kent.johnstone_1

Hello, I thought when creating a struct, I could call it anything I want. However, in the line: static struct usb_device_id usbtmc_devices[] = {... my compiler gives me "unable to resolve identifier 'usb_device_id'". Are struct names supposed to be defined somewhere else?

Member Avatar for kent.johnstone_1
0
124
Member Avatar for asmona

heyyy im trying to write a code to read from a file book name#Auther#subject#year the title takes 50 char anth then wanna sorted using bucket sort and continue by ( write to the file ) i just dont know how ! could u help me ?!

Member Avatar for deltascrow
0
81
Member Avatar for jchimz

Hi I need detail on using pictures in c code.My system has to upload,store and display picuters.Please help.

Member Avatar for Schol-R-LEA
0
107
Member Avatar for hayate98

// code says misplaced else can some tell me why and if possible make the correction? #include<stdio.h> #include<conio.h> char oper; int num[2]; int ans; main() { clrscr(); printf("Num:"); scanf("%d",&num[0]); printf("+"); scanf("%c",&oper); { if(oper=='+') { printf("+"); } { printf("Num:"); scanf("%d",&num[1]); } ans = num[0] + num[1] ; printf("%d",ans); } { else …

Member Avatar for hayate98
0
166
Member Avatar for thexile

Hi How do I go about reading from a file (Input_image.txt) that contains a 2-D (50 by 100 = 5000 elements) array? E.g. > 000 004 567 034 ... > 001 046 923 987 ... > 004 345 003 745 ... > 034 870 003 805 ... > 054 345 …

Member Avatar for Ancient Dragon
0
248
Member Avatar for dendenny01

I want to designe a code at display a perticular data Example a time table of the week For instance if someone view a page on monday so it show display result of the table or data which is set to display on monday or if some one view same …

Member Avatar for dendenny01
0
290
Member Avatar for Decode098

This code wont doest display the answer why???/ #include <stdio.h> #include <conio.h> void main() { int opcode; int num[2]; int result; clrscr(); printf("Program for Addition, Subtraction, Multiplication and Division\n"); printf("Enter First Number:"); scanf("%d", &num[1]); printf("Enter Your Choice: 1 - Add, 2 - Sub, 3 - Mul, 4 - Div: "); …

Member Avatar for Decode098
0
133
Member Avatar for jethro28

#include<stdio.h> #include<conio.h> #include<ctype.h> char c,ch; //choosing long int dec,quotient; // long int *pdec; // int bin[100],i=1,j; //Binary int *pbin,*pi,*pj; // long int octal,*poctal; //Octal long int hexa,*phexa; //Hexadecimal main() { clrscr(); gotoxy(5,7); printf("A. Binary"); gotoxy(5,8); printf("B. Octal"); gotoxy(5,9); printf("C. Hexadecimal"); gotoxy(5,5); printf("Convert decimal to: "); scanf("%c",&c); c=toupper(c); { if(c=='A') { …

Member Avatar for jethro28
0
183
Member Avatar for nerdygirl118

The assignment is to implement the Banker's Algorithm using pthreads and mutex locks. We implemented the Banker's Algorithm and it works fine. When we began implementing the pthreads and mutex locks we ran into problems. We know that each process is a thread, and that the mutex lock is acquired …

Member Avatar for deceptikon
0
153
Member Avatar for Manasarala

hi, Below is the code that displays 2 similar images and pixel values BGR of both images. I wanted to know , how to calculate the distance(euclidean) between selected pixels in 2 images[like (100,100),(100,101) coordinate and so on.how to go about it?how to use the values of BGR and B1G1R1 …

0
142
Member Avatar for Decode098

Is there a possible way to stop an incrementing array ex. A[9]1~10 normaly it goes like 1 2 3 4 5 6 7 8 9 10 but is there a way that if a press a key it will stop at that point?? ex. 1 2 3 4 5[key pressed] …

Member Avatar for dendenny01
0
198
Member Avatar for shhhhhh14

Help me with writing a program that calculates the average value of the elements of a 1- dimensional array of size N.

Member Avatar for rubberman
0
101
Member Avatar for Learningvinit

I was using certain lex and yacc file on 32 bit little endian Linux machine with gcc compiler. Now its upgraded to 64 bit it little endian Linux machine with icc compiler. I am facing lots of run time error which was not there earlier. Can anyone help me out …

Member Avatar for rubberman
0
175
Member Avatar for Decode098

This Programs is a Simple Calculator that usses Arrays and pointers. Currently a freshman student and im completely lost on the errors i keep on getting #include<stdio.h> #include <conio.h> main() { clrscr(); int num1[5],num2[5],sum[5],*n1,*n2,x; char oper[4],*o; *n1 =num1[5]; *n2 =num2[5] *o = oper[4]; oper[0] ='*'; oper[1] ='+'; oper[2] ='-'; oper[3] …

Member Avatar for cproger
0
316
Member Avatar for terabyte

Many string functions seem to work without the null byte... is it necessary to add it all the time? and my second question, does scanf %s automatically ads the null byte?

Member Avatar for deceptikon
0
141
Member Avatar for Kristjon

1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 T 0 1 S 0 0 1 1 1 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 …

Member Avatar for Moschops
0
119
Member Avatar for terabyte

seems like I never need malloc to allocate memory dinamically when it comes to strings example: int main(void) { char *str; puts("keyword:"); scanf("%30[^\n]\n",str); printf("%s",str); } I never defined str size, yet it works sorry if this is a stupid question it's 2 am and I'm studying for some c quiz …

Member Avatar for sepp2k
0
115
Member Avatar for mical700

I have problem reading file form command line. I am trying to do " abcd: ./rev < numbers", but it gives me an error: ./rev < numbers Usage : ./rev FILENAME Here is the code: #include <stdio.h> #include <stdlib.h> void reverse(FILE * file) { int fscanf_return_value; char x; /* read …

Member Avatar for mical700
0
364

The End.