C/C++ :: Error In Scanning Database Names

Feb 13, 2014

I'm working on a program to store student's names, ID, and GPA, but for some reason the first and last name of the student are copied into every name of the database array once I scan them, regardless of whether or not add_student even runs.

typedef struct{
char *f_name;
char *l_name;
int stud_id;
double gpa;
} student_t;
int add_student(student_t db[], char fname[], char lname[], int iden, double grade, int db_size){
int i, error;

[Code] ....

For example, if I type "a Adam Johnson 1234 4.00" it'll add the first student with name Adam Johnson. However, if I try to add another student named "Kyle Walker", it overwrites "Adam Johnson" with "Kyle Walker" as soon as the names are scanned.

View 3 Replies


ADVERTISEMENT

C :: Scanning Words Into Binary Search Tree - No Stack Error Diving Seg Fault

Apr 2, 2013

This is the first time I have encountered a "no stack." error giving me a seg fault. Anyhow, I am scanning words into a binary search tree and it is giving me a seg fault.

Here is the file (words.txt):
4
bravo
alpha
gamma
delta

Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

typedef struct node_t{
char *word;
struct node_t *left;
struct node_t *right;

[Code] .....

View 5 Replies View Related

C# :: ArgumentNullException Error When Adding To Database

Jan 24, 2014

I am trying to add some data to my SQL database using EntityFramework as so:

[HttpPost]
public ActionResult Add(string moduleCode)
{
HttpCookie cookie = Request.Cookies["UserLogin"];

[Code]....

When ever it gets to the stage of db.SaveChanges() I get this error, but using intellisense I have checked the values in the object and there are no Null fields.

Do you think It might be better to use SQLConnection instead? Also I beleive EntityFramework is more secure becuase there is no SQL Injection, is this correct? So If I do go down the SQLConnection route could this SQL Injection pose a threat?

View 8 Replies View Related

C++ :: Employee Database - Bizarre Error With If Statement

Dec 21, 2014

I have written a program that stores employees in a database object. You can Add, hire, fire, promote, demote, and display employees. The program uses an interface, a database class, and an employee class with member functions.

The strange behavior is in my switch statement in interface.cpp. I have a '#' that represents a command line. Add and Display functions are ok, but if I hire, fire, promote or demote. It will display '##' for the next input. I ran the debugger and after hire/fire/promote/demote is called, the first if-statement goes to 'else' and I'm trying to figure out why.

Note: main() calls mainMenu() to run the program

// interface.cpp
#include <iostream>
#include "database.h"
#include "display.h"
void mainMenu() {
displayMenu();
Database* employeeDatabase = new Database();

[Code] .....

Here are the two classes...

// database.cpp
#include <iostream>
#include <vector>
#include <memory>
#include "employee.h"
#include "database.h"
using namespace std;

[Code] .....

View 6 Replies View Related

C Sharp :: Winform Installer Error From Database Connection

Aug 20, 2013

I was created winform application with sql data base, after i created it i was converted to the installer file,for the other users but when they run the application did not connect to the database, how i fix this stuff...?

View 1 Replies View Related

C++ :: Sqlite - Error / Unable To Open Database File

Nov 10, 2012

I am receiving error: "unable to open database file" using sqlite3_open function. I am using sqlite3.c (included amalgamation files). It happens only during ARM compiling/run. If I do the same at x86 compile/run everything works fine...

I am using MAC Osx 10.7.4., Xcode 4.3.2.

View 1 Replies View Related

C Sharp :: Syntax Error In Update Query Using MA Access Database And Net 4.0

Feb 21, 2014

private void update_Click(object sender, EventArgs e)  {
            OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=C:UsersshobhitDocumentsEnvironment_Monitoring.accdb;
Jet OLEDB:Database Password=divya6");
            String sdat = dateTimePicker1.Value.ToShortDateString();
            String la = labs.SelectedItem.ToString();

[Code] ....

View 1 Replies View Related

C Sharp :: Call That Counts Number Of Entries In Database - Cast Error

Jul 14, 2013

I have an issue with a database call. I've got a database call that counts the number of entries in the database:

        private static Int32 dbCount() {
            SqlCommand cmd = new SqlCommand("SELECT COUNT (*) FROM Employees", conn);
            conn.Open();
            Int32 count = (Int32)cmd.ExecuteScalar();
            conn.Close();
            return count;
        }  

Afterwards I'm using this as a check throughout my application:

           if (dbCount > 0)  {
                // do something
            }  

When I execute this code I'm getting the following error: "Operator '>' cannot be applied to operands of type 'method group' and 'int'"

So I'm guessing it has something to do with the cast of the dbCount-object but I don't understand why as I already stated that the count-object to be an Int32.

View 3 Replies View Related

C++ :: Delete Specified Names From A List Of Store Names?

Feb 10, 2013

i have a vector of stores. i would like to delete the specified choice(store) from the list. Here is what i have but my erase statement is wrong and wont compile.

void Store::deleteSpecifiedStoreFromList(string choice) {
for (int i = 0; i < this->stores.size(); i++) {
if(this->stores[i].getStoreNames() == choice) {
this->stores.erase( std::remove_if( this->stores.begin(), this->stores.end(), choice ), this->stores.end() );
}
}
}

View 4 Replies View Related

C# :: How To Multithread Port Scanning App

Jan 24, 2012

I'm creating a small port scanning app which use a port range defined by user.My problem with the code is that I find it not efficient enough meaning that it ping very slow, especially when ports are not responding meaning that I must wait for the timeout before continuing to next port.

I want to make this small app threaded. The problem here is that I'm kind of blank of how to implement threading in my program. This is my code which is a method which does the actual checking, the other part of the code is a simple button with for loop for advancing my port number.

Code:

private void ScanPort(IPAddress address, int port) {
using (TcpClient client = new TcpClient() {
IAsyncResult result = client.BeginConnect(address, port, null, null);

if (result.AsyncWaitHandle.WaitOne((int)nudTimeout.Value, false)) txtDisplay.AppendText("Port: " + port + " is open." + Environment.NewLine);
else txtDisplay.AppendText("Port: " + port + " is closed." + Environment.NewLine);
} }

I have read some basic threading tutorial but I just don't know how to implement this piece of code so I can check ports much faster.

View 3 Replies View Related

C :: Scanning CSV File And Assigning Variable To It

Dec 26, 2013

How to scan a CSV file and assigned variable to each of the integer scanned in a csv file

an example of the csv file:
0001,40,,10

How do I scan the CSV file and assign 0001 to variable student id, the 40 to variable module 01,the 1 without input entered to module02 and 10 to module03

View 6 Replies View Related

C :: Scanning 2 Strings In Same Scanf Call

Nov 20, 2013

Somehow only str2 is successfully scanned and str1 is not printed

Code:

printf("
Please enter two times in this way xx.xx xx.xx now ");
scanf("%s%s", str1, str2);
printf("
%s - %s:
", str1, str2)); result : - str2:

View 3 Replies View Related

C :: Scanning Characters Into A Multidimensional Array

Mar 19, 2014

I have initialized a multidimensional array eg char fruit[5][10]...Then I would need to read in 3 words with spaces in between from user and store in fruit[5][10] e.g "pear apple orange"

The thing is that after typing orange, when I press Enter it still prompts me to enter more characters. How can I end the scanning of characters after orange ?

View 4 Replies View Related

C :: Scanning Equations / Functions Into Program

Nov 15, 2014

I have to make a numerical integration program, how I can write my code so that the user is able to write their own function that they want to integrate?

E.g. they would see the message: 'please enter your function' and would be able to write whatever they wanted e.g. 'x +5' then this would then be integrated by the program.

I have already written a program that can integrate a known function but would prefer that the user could choose their own.

View 2 Replies View Related

C/C++ :: Scanning CSV File Into Array Of Structs

Mar 18, 2015

I need to scan a .csv file that contains the following info:

programming,03,60,141,01,W,2015
programming,03,60,141,30,W,2015
Algebra,03,62,102,02,S,2013
Religion,08,98,938,20,F,2014

So i made a struct:

typedef struct CourseInfo {
int courseID;
char courseName[50];
char courseCode[13];
char term[7];
} courseinfo;

Where course code is the 4 numbers after the name together and the term is the letter and year in the last two pieces of info. I got this to work:

int main() {
FILE *p;
p = fopen("input.csv", "r+");
if(p == NULL) {
puts("The file could not be opened");

[Code] ......

But lets say i dont know how many lines i have in my file and i want to count them and then use that size for my array so i tried this by:

int main() {
FILE *p;
int lines = 1;
char ch;
p = fopen("input.csv", "r+");
if(p == NULL) {

[Code] .....

But the second program is not working for unknown reasons. I do not get any errors but its not scanning the info because when i print the info later on it prints out random symbols.

View 11 Replies View Related

C :: Scanning A File With Words And Int / Float Numbers

Dec 1, 2013

scanning a file with both words and INT's/Float numbers. This is the file data here.

15 25 200
3 10
17.99 22.99 109.99
100 2 4
5.99 99.99 20.00 49.99
10 10 10 10 10 10 10 10 10 10
3.99 5.99 7.99 8.00 5.00 5.00 5.00 6.00 7.00 9.99

[Code]...

What I'm focused on is reading in the first three numbers which I already have with fscanf and then reading in BUY TICKET with the digit afterwards. My problem is that I don't know how to reach that part of the file without scanning in something I don't want to. Also, how would I scan the number after scanning BUY TICKET? Would it be something like using %s and %d right afterwards?

View 4 Replies View Related

C :: Scanning 2 Dimensional Array For Duplicate Values

Mar 26, 2013

I am trying to scan a 2 dimensional array to see if there are any duplicates within a row or column; i.e. the concept of a sudoku game.how to scan a row or column one at a time.

View 1 Replies View Related

C++ :: Scanning A Header File To Save Image Data

Jun 11, 2013

I'm trying to read from a header file to take the image dimensions and other variables but I don't understand how to iterate through the "key" so it saves each line.

This is what the header file will always look like:

!INTERFILE :=
!imaging modality := nucmed
!version of keys := 3.3
;
!GENERAL DATA :=

[Code].....

Ideally it would just skip the keys that aren't wanted and keep moving through the lines. Should there be a for loop for the key (and if so, how does that work with pointers?) or should this method just be scratched...

View 6 Replies View Related

C :: Scanning Numbers From TXT File Into A File

Mar 6, 2015

I'm new to programming and I have a question about scanning numbers from a .txt file into a .c file. I have an array that has 50 integers and I want to read in 50 numbers from a .txt file. What would I type in on the command line to get the array to read in the .txt numbers?

View 1 Replies View Related

C :: Array Of File Names

Feb 9, 2013

I am trying to create an array of file names such that when I want to open one of the files, who's name is given in the array, I can call that element of the array. My code for making the array is the following,

Code:
char file_name[40];
char *file_locations[N]; // array of N names (*)
for(ii=0; ii<=N-1; ii++){ // printing the names of all the files P1_8mag_1.txt - P1_8mag_N.txt
sprintf(file_name, "P1_8mag_%i.txt", ii+1);

[Code]....

The problem with this is that in the first step: all elements of the array "file_locations" are the name of the last file in the loop (in this case "P1_8mag_N.txt")What is wrong with this?

View 12 Replies View Related

C :: Display The Names In A Queue

Mar 12, 2014

I have an assignment that needs to display the names of customers to be served according to a sequence. coding to display the names accordingly?

Code:

#include <stdio.h>
#include <stdlib.h>
#define MAXIMUM 20
void create();

[Code].....

This is my output. I have trouble displaying the names of the customers as it outputs null when I try to display my position in queue.

View 4 Replies View Related

C :: Pointer - How To Accept 50 Names

Mar 24, 2013

char *name[50]

How to accept 50 names using above definition...

View 3 Replies View Related

C++ :: Sorting Car Names According To Their Mileage

Feb 24, 2013

All I wanted to do is to sort the car names according to their mileage. And display the output with their car names. This is what I've made

#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
int j;
class car

[Code].....

I need to take 5 car details and sort them according to their Mileage..

View 4 Replies View Related

C++ :: Splitting First And Last Names From String

Jan 15, 2013

The following code shows bad memory access error (segmentation fault) when I run it. It does this right after it asks for name and the user has entered it.

#include <iostream>
#include <sstream>
using namespace std;
struct Name {
string first;
string last;

[Code] ....

View 4 Replies View Related

C++ :: Find A Name In Struct Of Names

Jul 6, 2014

I cannot find the second name in the struct. First name comes out ok here is the code. I am reading from a file.

struct asma{
char name[200];
char birth[100];

[Code].....

View 2 Replies View Related

C# :: How To Get Column Names From Db3 File

Oct 2, 2014

I have .db3 file, and he has 14 tables,and every table has certain number of columns. Example i have table called "BASIC_INFO" and that table has columns "First Name", "Last Name" and "Age".

How can i get name of table and name of every column,so if i some day add column "Male" i get name of this column too. I need first to calculate number of columns,put that in some integer, and then for example create string array which will contain : array[0] = "First Name" ,array[1] = "Last Name"...

SQLiteConnection myConn = new SQLiteConnection("Data Source=" + DB3Path + ";Version=3;New=False;Compress=True;");
//string query = "Select * From " + DB3Path + ".INFORMATION_SCHEMA.COLUMNS";
string query = "Select * From BASIC_INFO.INFORMATION_SCHEMA.COLUMNS;";
SQLiteCommand sqCommand = new SQLiteCommand(query);

[Code] ....

I tried this too:

string query = "select * from INFORMATION_SCHEMA.COLUMNS"
+ "where TABLE_Name='BASIC_INFO'"
+ "order by ORDINAL_POSITION;";
string query = "SELECT TOP 0 * FROM BASIC_INFO";

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved