C :: Code To Hit Database And Check File Size
Jan 13, 2015
I have been given a task of checking the size of file in Linux machine using C Program. Below is what I came up with
Code:
#include <stdio.h>
void main(int argc, char **argv) {
FILE *fp;
char ch;
int size = 0;
[Code] .....
But Now I have been asked to modify this code in a way that instead of passing the file name as parameter, I have to make a database connection and fetch the value of the filename and location from the database table and check the size . My program has to repeat this process every ten minutes, which means every ten minutes my program has to hit the database, fetch the value and check the size in the file system.
I heard like I Have to create a Fork Call, and have the child instance run every ten minutes.
View 6 Replies
ADVERTISEMENT
Jul 25, 2014
I read online about Cyclic Redundancy Check and how it works.
ThisStack Overflow response explains it so well on a layman level.
I found some code online on how to implement it and what library to include in C#. I've looked at it and I can grasp how the algorithm works with the remainders.
What I don't understand is how can I integrate my database, which is a sql server localdb file into the CRC32 check, so that I can test for the database integrity. I'm not sure how to proceed.
Do I test each table individually and send the size of the table(in bytes) and compare it to the value it's supposed to be?
View 3 Replies
View Related
Apr 11, 2013
how to give a database connection to a c++ code i am using turbo c++ as an editor and if i have oracle 11g client, odbc as a driver , what else i require and how to link these things in a code.
View 1 Replies
View Related
Feb 13, 2014
i want programcode which can be executed for create database add delete record in ubuntu
View 1 Replies
View Related
Jan 13, 2015
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int check_Pythag(int DIMA, int DIMB, int DIMC) {
[Code] .....
View 4 Replies
View Related
Mar 24, 2013
I have this code to check if file exist already and its work, but what i need is : is to add feature to function to see if the file already exist open same file and rename it with another name ,probably file2
assume file name is "abc.c"
This scenario like this
User>>(provide file name)
Code>>(check if file already exist show msg:
"File already (abc.c) exist would you like to create another file and rename it ("abc2.c") "maybe it need loop to search directory "????
User>>if press yes ok it will make another file with another name but if no exit the function and dont create another file
Code: // function to check file existence and here what i need to add the feature above
int fExist(const char* fn){
struct stat buffer;
int exist = stat(fn,&buffer);
if(exist == 0)
[Code] .....
View 2 Replies
View Related
Feb 17, 2015
I am interested in creating a file of a given size and then randomly accessing the file to populate it. Is there a way to quickly create, for instance, a 4 GByte file in C++, initially populated with garbage?
View 4 Replies
View Related
May 6, 2013
Any tutorial to learn?
View 8 Replies
View Related
Feb 7, 2013
Book database. I use scanf to store book name,author name and year when is book written. Example:
Code:
scanf(" %[^
]",k[i].bookname);
I have problem when i want to printf all books from database with this:
Code:
for(i=0;i<counter;i++){
fscanf(f,"%s %s %d",k[i].bookname,k[i].author,&k[i].year);
printf("
%d %s %s %d",(i+1),k[i].bookname,k[i].author,k[i].year);} Output:
Number Book name Author name Year
1 King John 0
2 William Shakespeare 1590
How can i fix this?
View 4 Replies
View Related
Jun 10, 2014
I have created a desktop application using c#.net in visual studio 2005 and sql server 2005, i have created a setup file also but i dont have database in it.. how to include or attach the database file into the project so that it works well in the client machine.....
View 1 Replies
View Related
May 5, 2014
If there is a simple way to check if a file contain a string?
View 1 Replies
View Related
May 19, 2014
found out that I had to split my project in two programs (console projects).
I wanna make sure in the main program that the logger runs and if I can, have the main program do commands within the console.
Now how can I do this? is it a header that I have to include? is it a built in feature of c++?
View 7 Replies
View Related
Aug 22, 2014
Which is best option to save images in database or file system, I am developing c++ server client app. I want to save the images in server using file system or database. I am confusing to choose which option?
View 5 Replies
View Related
Mar 4, 2014
Background: I've created a projected and added a mdf database file to it.
I am attempting to fill my datagridview with data from a table that I've added to my mdf file.
I am having a hell of a time figuring out the correct connection string and datasource file path for it.
I've decided on using OleDB because that's what I am most familiar with.
I clearly see the rule "Don't tell us to give you code!" but I cannot find a good tutorial from START to FINISH on how to do what I am trying to do.
As stated, I think my connection string is wrong. Even if I change it to
OleDB (string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Database.mdf"
I get a new error saying it cannot recognize the database format.
public partial class DataViewer : Form {
string conStr = "Provider=SQLOLEDB;Data Source=Database.mdf";
DataSet dS = new DataSet();
DataSet tdS = new DataSet();
OleDbConnection con = null;
[Code] ....
View 2 Replies
View Related
Aug 3, 2013
I am developing a win form application with sq l server2005, in client system after install the application I created the folder for storing the database of running application, like that I have every year database separately, My doubt is how to connect the particular year database while loading the app?
View 1 Replies
View Related
Feb 14, 2015
I am trying to make a program that asks for password when you try to open a file. I tried with that, obviously without success .
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
using namespace std;
int main () {
ifstream file("test.txt");
string password;
[Code] ....
View 11 Replies
View Related
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
Mar 27, 2015
I have a function in one src file called from code in a different src file.
In ig_cfunc.cpp
Code:
#include "ig_tools.h"
int x2_count = 0.0;
float rel_branch_degree_tmp = 0.0;
string type;
vector<int> is_disp_type;
[Code] ....
I am getting a linker error,
Code:
ig_cfunc.cpp:1609: error: `calc_rel_branch_degree' undeclared (first use this function)
I have deleted all of the objects and recompiled to make sure that everything is in sync. I can't see what the issue is here and I'm not sure what to do next. This code actually worked until I changed the name of the function, so the types are all correct and such. This is the format I use for all external functions ....
View 1 Replies
View Related
Sep 29, 2012
i have to upload a ms access database file to the server from my client program. The server program should connect to this database and read the data. What's the easiest way to upload the file? Is it FTP? i tried sockets, but it only allows like 9kb of data transfer capacity.
View 3 Replies
View Related
Feb 27, 2013
how i upload excel file with value Save in database on server without show error.
Actually i have code who work correct on local host but not work on server then show error who write down Below
Microsoft.ACE.OLEDB.12.0 is not registered local machine.
View 5 Replies
View Related
Jun 6, 2013
I wrote a program that should check if phrase is in file and output the result.
File:
//////////////
Eat my shorts!
Ay Carumba!
Stupid Flanders...
////////
Why my program doesn't cout?
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <fstream>
using namespace std;
string checkData (char Input[], char dataB [], int nMAX){
[Code] .....
View 2 Replies
View Related
Jan 27, 2015
finishing my program which needs to do the following:
(i) Write code to read in the dictionary into an array of words
(ii) Write code to check the spelling of a word entered by the use
(iii) Like Scrabble / Countdown the user enters the letters they have and my code must find the word using the highest number of those letters
I have completed a good bit so far but I'm stuck on my checkSpelling() and findWord() functions as well as part (iii)
#include "stdafx.h"
#include <stdio.h>
#include "string.h"
int countCharOccurence(char *string, char c);
int getOption();
int checkSpelling();
[Code]....
View 3 Replies
View Related
Mar 18, 2013
Write a program that is able to save a list of items such as books, CDs, or DVDs and the items that are saved must have attributes associated with them. For example a book has a title, author, publisher, and ISBN.I would like to create a program that is able to save the database of items to a file on the hard drive and also retrieve it from the hard drive.I have this for a start of how to set up a storing program.
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
const int arraySize = 10;
int a[arraySize] = { 2, 6, 4, 10, 12, 89, 68, 45, 37 };
int i, hold;
[code]....
View 2 Replies
View Related
Apr 10, 2013
I have to create a small data base for a shop. One of the functions i am creating is taking a customers ID and scanning that through a text file and to print out the info about that customer. What i am having trouble with is where do i insert the string compare in my program?
//declaring array for input of customer ID
int customer_ID [20];
printf("Please enter the customer ID:");
gets( customer_ID ); //users input stored in the array
[Code] .....
View 2 Replies
View Related
Oct 6, 2013
I've been looking into the file structure of BMP images and everything I'm reading says that the 4 bytes following the signature are designated as the filesize of the bmp file... It's always zero for me regardless of the BMP file. The signature is always correct though.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
[Code]....
View 9 Replies
View Related
Sep 21, 2013
Just wonder is it possible that if the file exist, this function below will fail by returning non-zero value?
_access( INIFilename, 00 )
00 - check for Existence only
I noticed that sometimes if even the file exist, the function will fail or return non-zero value. So trying to find out and duplicate this error. It tends to happen intermittently. How can I find out what causing this error?
Code:
char INIFilename[256]="C: emp est.ini";
unsigned long Error = 0;
if( _access( INIFilename, 00 ) != 0 ) {
Error= GetLastError();
printf ("Failed to access INI file %s (%ul)", INIFilename, Error);
}
View 5 Replies
View Related